-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (37 loc) · 1.06 KB
/
index.js
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
#! /usr/bin/env node
const deploy = require('./lib/deploy.js');
const pkg = require('./package.json');
const program = require('commander');
let type = "";
program.allowUnknownOption()
.version(pkg.version)
.option('-e, --env <env>', 'deploy by env[dev/test/prod]')
.option('-c, --configJsonName <configJsonName>', 'deploy config json name')
.option('-d, --debug', 'show debug message');
program.command('init').description('create deploy.json').action(() => {
type = 'init';
});
program.parse(process.argv);
if (type == 'init') {
deploy.init();
return;
}
let env = 'dev';
let configJsonName = 'deploy.json';
let showDebug = false;
if (program.env) {
env = program.env;
} else {
console.log('default env : ' + env);
}
if (program.configJsonName) {
configJsonName = program.configJsonName;
} else {
console.log('default configJsonName : ' + configJsonName);
}
if (program.debug) {
showDebug = program.debug;
} else {
console.log('default show debug message : ' + showDebug);
}
deploy.deploy(configJsonName, env, showDebug);