1 | #!/usr/bin/env node
|
2 | require("ts-node/register/transpile-only");
|
3 | import * as sade from "sade";
|
4 | const { version } = require("../package");
|
5 |
|
6 | const commands = {
|
7 | init: () => require("./commands/init"),
|
8 | dev: () => require("./commands/dev"),
|
9 | build: () => require("./commands/build"),
|
10 | test: () => require("./commands/test")
|
11 | };
|
12 |
|
13 | const cli = sade("typepack");
|
14 |
|
15 | cli
|
16 | .version(version)
|
17 | .option("--debug, -d", "Run CLI in debug mode")
|
18 |
|
19 | .command("init [name]")
|
20 | .describe("Initialize a new project")
|
21 | .option("-m, --mode", "The mode of the Typepack build", "web")
|
22 | .option("--force, -f", "Force project dir creation", false)
|
23 | .action(commands.init())
|
24 |
|
25 | .command("dev")
|
26 | .describe("Start development server")
|
27 | .option("--open", "Should the app be opened in the browser or not", true)
|
28 | .option("-p, --port", "A port number on which to start the application", 8080)
|
29 | .action(commands.dev())
|
30 |
|
31 | .command("build")
|
32 | .describe("Start production build")
|
33 | .option("--dev", "Run build in development mode", false)
|
34 | .option("--analyze", "Launch bundle analyzer", false)
|
35 | .option("--smp", "Measure build times", false)
|
36 | .action(commands.build())
|
37 |
|
38 | .command("test")
|
39 | .describe("Run unit tests")
|
40 | .action(commands.test())
|
41 |
|
42 | .parse(process.argv);
|