-
Notifications
You must be signed in to change notification settings - Fork 3
/
jane
executable file
·58 lines (50 loc) · 1.14 KB
/
jane
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
54
55
56
57
58
#!/usr/bin/env node
let program = require('commander');
let utils = require('./utils/utils')
program
.option('-v, --version', '显示版本号', () => {
console.log(utils.getVer())
})
.option('-w, --watch', '监视目录改动')
program
.command('clean')
.description('清空build目录')
.action(() => {
require('./lib/clean')
})
program
.command('build')
.description('编译项目')
.action((cmd) => {
if(program.watch){
require('./lib/build')(()=>{
require('./lib/watch')
})
}
else{
require('./lib/build')()
}
})
program
.command('new <project>')
.description('新建项目')
.action((project) => {
require('./lib/create')(project)
})
program
.command('page <page>')
.description('新建页面')
.action((project) => {
require('./lib/page')(project)
})
// program
// .command('upgrade')
// .description('更新')
// .action(() => {
// require('./lib/upgrade')
// })
program.parse(process.argv)
// no args: show help
if (!process.argv.slice(2).length) {
program.outputHelp();
}