|
1
|
#!/usr/bin/env node |
|
2
|
import chalk from "chalk" |
|
3
|
import { program } from "commander" |
|
4
|
import generate from "./commands/generate.js" |
|
5
|
import path from "path" |
|
6
|
import { getDirname } from "utils" |
|
7
|
|
|
8
|
const __dirname = getDirname(import.meta.url) |
|
9
|
|
|
10
|
program |
|
11
|
.description("Generate React specs used for documentation purposes.") |
|
12
|
.requiredOption( |
|
13
|
"-s, --src <srcPath>", |
|
14
|
"Path to a file containing a React component or a directory of React components." |
|
15
|
) |
|
16
|
.requiredOption("-o, --output <outputPath>", "Path to the output directory.") |
|
17
|
.option( |
|
18
|
"--clean", |
|
19
|
"Clean the output directory before creating the new specs", |
|
20
|
false |
|
21
|
) |
|
22
|
.option( |
|
23
|
"--tsconfigPath <tsconfigPath>", |
|
24
|
"Path to TSConfig file.", |
|
25
|
path.join(__dirname, "..", "..", "typedoc-config", "ui.json") |
|
26
|
) |
|
27
|
.option("--disable-typedoc", "Whether to disable Typedoc", false) |
|
28
|
.option("--verbose-typedoc", "Whether to show Typedoc logs.", false) |
|
29
|
.parse() |
|
30
|
|
|
31
|
generate(program.opts()).catch((e) => { |
|
32
|
console.error(chalk.red(e instanceof Error ? e.message : e)) |
|
33
|
process.exit(1) |
|
34
|
}) |