UNPKG

2.3 kBJavaScriptView Raw
1#!/usr/bin/env node
2
3// Copyright 2019 Zaiste & contributors. All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16const validateNode = require('validate-node-version')('>=7.6.x');
17
18if (!validateNode.satisfies) {
19 console.error(validateNode.message);
20 process.exit(1);
21}
22
23const _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;