1 | #!/usr/bin/env node
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | const validateNode = require('validate-node-version')('>=7.6.x');
|
17 |
|
18 | if (!validateNode.satisfies) {
|
19 | console.error(validateNode.message);
|
20 | process.exit(1);
|
21 | }
|
22 |
|
23 | const _argv = require('yargs')
|
24 | .version()
|
25 | .usage('Usage: $0 <command> [options]')
|
26 | .command(
|
27 | ['new [dir]', 'init', 'n'],
|
28 | 'Create new project',
|
29 | require('./cli/init')
|
30 | )
|
31 | .example('$0 new my-project', 'Create and initialize `my-project` directory')
|
32 | .command(
|
33 | ['start', 'start', 's'],
|
34 | 'Start the application',
|
35 | require('./cli/start')
|
36 | )
|
37 | .example('$0 start', 'Start the application')
|
38 | .command(
|
39 | ['client', 'client', 'c'],
|
40 | 'Start only the client',
|
41 | require('./cli/client')
|
42 | )
|
43 | .example('$0 client', 'Start only the client')
|
44 | .command(
|
45 | ['server [dir]', 'serve', 'se'],
|
46 | 'Serve the directory',
|
47 | require('./cli/server')
|
48 | )
|
49 | .example('$0 server --port 4000', 'Serve the directory at the port 4000')
|
50 | .command(
|
51 | ['build', 'build', 'b'],
|
52 | 'Build the application for production',
|
53 | require('./cli/build')
|
54 | )
|
55 | .example('$0 build', 'Build the application for production')
|
56 | .command(
|
57 | ['database [command]', 'db'],
|
58 | 'Database operations',
|
59 | require('./cli/database')
|
60 | )
|
61 | .command(
|
62 | ['deploy', 'deploy', 'de'],
|
63 | 'Deploy the application',
|
64 | require('./cli/deploy')
|
65 | )
|
66 | .example('$0 deploy', 'Deploy the application')
|
67 | .command(
|
68 | ['generate [command]', 'g'],
|
69 | 'Generate various artifacts',
|
70 | require('./cli/generate')
|
71 | )
|
72 | .demandCommand(1, 'You need at least one command before moving on')
|
73 | .help('h')
|
74 | .alias('h', 'help')
|
75 | .epilogue(
|
76 | 'for more information, find the documentation at https://huncwot.org'
|
77 | ).argv;
|