-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
61 lines (46 loc) 路 1.96 KB
/
Copy pathcli.ts
File metadata and controls
61 lines (46 loc) 路 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { parseArgs } from 'jsr:@std/cli@1.0.20/parse-args';
import chalk from 'npm:chalk@5.4.1';
/** Commands */
import { bundleDts } from './cli/bundle-dts.ts';
import { build } from './cli/build.ts';
import { create } from './cli/create.ts';
function printHelp() {
console.log(`
${chalk.bold.cyan('C3React CLI Tool')}
${chalk.gray('Usage:')} ${chalk.green('c3react')} ${chalk.yellow('<command>')} [options]
${chalk.bold('Available commands:')}
${chalk.yellow('create')} ${chalk.white('Create empty project')}
${chalk.yellow('dev')} ${chalk.white('Start development mode')}
${chalk.yellow('build')} ${chalk.white('Build the project')}
${chalk.yellow('bundledts')} ${chalk.white('Bundle all C3 .d.ts into "ts-defs.d.ts"')}
${chalk.yellow('help')} ${chalk.white('Show this help message')}
`);
// ${chalk.yellow('version')} ${chalk.white('Show CLI version')}
// ${chalk.bold('Options:')}
// ${chalk.cyan('--verbose')} ${chalk.white('Enable verbose output')}
// ${chalk.cyan('--config')} ${chalk.white('Path to custom config file')}
// ${chalk.bold('Examples:')}
// ${chalk.gray('$')} ${chalk.green('mycli')} ${chalk.yellow('init')}
// ${chalk.gray('$')} ${chalk.green('mycli')} ${chalk.yellow('build')} --config ./config.json
}
async function main() {
const args = parseArgs(Deno.args);
if (args._.includes('help')) {
return printHelp();
}
if (args._.includes('bundledts')) {
return await bundleDts();
}
if (args._.includes('build')) {
return await build();
}
if (args._.includes('dev')) {
return await build({ isDev: true });
}
if (args._.includes('create')) {
return await create();
}
return printHelp();
}
await main();
export type { IConfig } from './cli/config.ts';