|
1 | | -import { Command } from 'commander'; |
2 | | -import pc from 'picocolors'; |
3 | | -import { buildCommand } from './commands/build.js'; |
4 | | -import { devCommand } from './commands/dev.js'; |
5 | | -import { ejectCommand } from './commands/eject.js'; |
6 | | -import { templateListCommand, templateCacheCommand } from './commands/template.js'; |
| 1 | +import { Command } from "commander"; |
| 2 | +import pc from "picocolors"; |
| 3 | +import { buildCommand } from "./commands/build.js"; |
| 4 | +import { devCommand } from "./commands/dev.js"; |
| 5 | +import { ejectCommand } from "./commands/eject.js"; |
| 6 | +import { |
| 7 | + templateListCommand, |
| 8 | + templateCacheCommand, |
| 9 | +} from "./commands/template.js"; |
7 | 10 |
|
8 | 11 | export async function cli() { |
9 | 12 | const program = new Command(); |
10 | 13 |
|
11 | 14 | program |
12 | | - .name('superdocs') |
13 | | - .description('The open-source Mintlify alternative. Beautiful docs from Markdown.') |
14 | | - .version('0.3.0'); |
| 15 | + .name("superdocs") |
| 16 | + .description( |
| 17 | + "The open-source Mintlify alternative. Beautiful docs from Markdown." |
| 18 | + ) |
| 19 | + .version("0.3.5"); |
15 | 20 |
|
16 | 21 | program |
17 | | - .command('build') |
18 | | - .description('Build the documentation site') |
19 | | - .requiredOption('-i, --input <path>', 'Path to the docs folder') |
20 | | - .option('-o, --output <path>', 'Output directory for the built site', './dist') |
21 | | - .option('-t, --template <name>', 'Template to use (default, github:owner/repo, or local path)', 'default') |
22 | | - .option('-b, --base-url <url>', 'Base URL for the site', '/') |
23 | | - .option('--search', 'Enable search functionality', false) |
24 | | - .option('--refresh', 'Force re-download template (bypass cache)', false) |
| 22 | + .command("build") |
| 23 | + .description("Build the documentation site") |
| 24 | + .requiredOption("-i, --input <path>", "Path to the docs folder") |
| 25 | + .option( |
| 26 | + "-o, --output <path>", |
| 27 | + "Output directory for the built site", |
| 28 | + "./dist" |
| 29 | + ) |
| 30 | + .option( |
| 31 | + "-t, --template <name>", |
| 32 | + "Template to use (default, github:owner/repo, or local path)", |
| 33 | + "default" |
| 34 | + ) |
| 35 | + .option("-b, --base-url <url>", "Base URL for the site", "/") |
| 36 | + .option("--name <name>", "Project name") |
| 37 | + .option("--description <description>", "Project description") |
| 38 | + .option("--primary-color <color>", "Primary theme color (hex)") |
| 39 | + .option("--accent-color <color>", "Accent theme color (hex)") |
| 40 | + .option("--favicon <path>", "Favicon path") |
| 41 | + .option("--logo <path>", "Logo path") |
| 42 | + .option("--search", "Enable search functionality", false) |
| 43 | + .option("--refresh", "Force re-download template (bypass cache)", false) |
25 | 44 | .action(buildCommand); |
26 | 45 |
|
27 | 46 | program |
28 | | - .command('dev') |
29 | | - .description('Start development server with watch mode') |
30 | | - .requiredOption('-i, --input <path>', 'Path to the docs folder') |
31 | | - .option('-t, --template <name>', 'Template to use (default, github:owner/repo, or local path)', 'default') |
32 | | - .option('-b, --base-url <url>', 'Base URL for the site', '/') |
33 | | - .option('--search', 'Enable search functionality', false) |
34 | | - .option('-p, --port <number>', 'Port for dev server', '4321') |
35 | | - .option('--refresh', 'Force re-download template (bypass cache)', false) |
| 47 | + .command("dev") |
| 48 | + .description("Start development server with watch mode") |
| 49 | + .requiredOption("-i, --input <path>", "Path to the docs folder") |
| 50 | + .option( |
| 51 | + "-t, --template <name>", |
| 52 | + "Template to use (default, github:owner/repo, or local path)", |
| 53 | + "default" |
| 54 | + ) |
| 55 | + .option("-b, --base-url <url>", "Base URL for the site", "/") |
| 56 | + .option("--name <name>", "Project name") |
| 57 | + .option("--description <description>", "Project description") |
| 58 | + .option("--primary-color <color>", "Primary theme color (hex)") |
| 59 | + .option("--accent-color <color>", "Accent theme color (hex)") |
| 60 | + .option("--favicon <path>", "Favicon path") |
| 61 | + .option("--logo <path>", "Logo path") |
| 62 | + .option("--search", "Enable search functionality", false) |
| 63 | + .option("-p, --port <number>", "Port for dev server", "4321") |
| 64 | + .option("--refresh", "Force re-download template (bypass cache)", false) |
36 | 65 | .action(devCommand); |
37 | 66 |
|
38 | 67 | program |
39 | | - .command('eject') |
40 | | - .description('Export the full Astro project source code') |
41 | | - .requiredOption('-i, --input <path>', 'Path to the docs folder') |
42 | | - .option('-o, --output <path>', 'Output directory for the project', './astro-docs-project') |
43 | | - .option('-t, --template <name>', 'Template to use (default, github:owner/repo, or local path)', 'default') |
44 | | - .option('-b, --base-url <url>', 'Base URL for the site', '/') |
45 | | - .option('--search', 'Enable search functionality', false) |
46 | | - .option('--refresh', 'Force re-download template (bypass cache)', false) |
| 68 | + .command("eject") |
| 69 | + .description("Export the full Astro project source code") |
| 70 | + .requiredOption("-i, --input <path>", "Path to the docs folder") |
| 71 | + .option( |
| 72 | + "-o, --output <path>", |
| 73 | + "Output directory for the project", |
| 74 | + "./astro-docs-project" |
| 75 | + ) |
| 76 | + .option( |
| 77 | + "-t, --template <name>", |
| 78 | + "Template to use (default, github:owner/repo, or local path)", |
| 79 | + "default" |
| 80 | + ) |
| 81 | + .option("-b, --base-url <url>", "Base URL for the site", "/") |
| 82 | + .option("--name <name>", "Project name") |
| 83 | + .option("--description <description>", "Project description") |
| 84 | + .option("--primary-color <color>", "Primary theme color (hex)") |
| 85 | + .option("--accent-color <color>", "Accent theme color (hex)") |
| 86 | + .option("--favicon <path>", "Favicon path") |
| 87 | + .option("--logo <path>", "Logo path") |
| 88 | + .option("--search", "Enable search functionality", false) |
| 89 | + .option("--refresh", "Force re-download template (bypass cache)", false) |
47 | 90 | .action(ejectCommand); |
48 | 91 |
|
49 | 92 | // Template management commands |
50 | 93 | const templateCmd = program |
51 | | - .command('template') |
52 | | - .description('Manage documentation templates'); |
| 94 | + .command("template") |
| 95 | + .description("Manage documentation templates"); |
53 | 96 |
|
54 | 97 | templateCmd |
55 | | - .command('list') |
56 | | - .description('List available templates') |
| 98 | + .command("list") |
| 99 | + .description("List available templates") |
57 | 100 | .action(templateListCommand); |
58 | 101 |
|
59 | 102 | templateCmd |
60 | | - .command('cache') |
61 | | - .description('Manage template cache') |
62 | | - .option('--clear', 'Clear all cached templates') |
| 103 | + .command("cache") |
| 104 | + .description("Manage template cache") |
| 105 | + .option("--clear", "Clear all cached templates") |
63 | 106 | .action(templateCacheCommand); |
64 | 107 |
|
65 | 108 | try { |
66 | 109 | await program.parseAsync(process.argv); |
67 | 110 | } catch (error) { |
68 | | - console.error(pc.red('Error:'), error.message); |
| 111 | + console.error(pc.red("Error:"), error.message); |
69 | 112 | process.exit(1); |
70 | 113 | } |
71 | 114 | } |
0 commit comments