-
Notifications
You must be signed in to change notification settings - Fork 5
/
ship
executable file
·53 lines (46 loc) · 1.51 KB
/
ship
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
#!/usr/bin/env node
// ======================
// Depends
// ======================
const __ENV = process && process.env && process.env.NODE_ENV
? process.env.NODE_ENV
: 'development';
const colors = require('colors');
const config = require('./config')(__dirname, process.cwd(), __ENV);
// ======================
// SHIP logo
// ======================
const ship = [
' ',
'................................',
'..####...##..##..######..#####..',
'.##......##..##....##....##..##.',
'..####...######....##....#####..',
'.....##..##..##....##....##.....',
'..####...##..##..######..##.....',
'................................',
].join('\n');
// ======================
// Check nodejs version
// ======================
if (process.versions.node.split('.').join('') < config.requirments.node.split('.').join('')) {
process.stdout.write(colors.bold.red(ship + '\n'));
process.stdout.write(colors.bold.red('NodeJS version is outdated' + '\n'));
process.stdout.write('Minimal node.js version is: ' + colors.green.bold(config.requirments.node) + '\n\n');
process.exit(0);
}
// ======================
// Initialize CLI
// ======================
const program = require('./cli/index')(
process.cwd(), __dirname, config
);
// ======================
// Parse command arguments
// ======================
program.parse(process.argv);
// ======================
// if program was called
// without arguments, show help.
// ======================
if (program.args.length === 0) program.help();