-
Notifications
You must be signed in to change notification settings - Fork 8
/
cli.js
executable file
·48 lines (41 loc) · 1014 Bytes
/
cli.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
45
46
47
48
#!/usr/bin/env node
/**
* phaser-node-kit
* @author C. Byerley
* @copyright (c)2017 develephant.com
* @license MIT
* https://github.com/develephant/phaser-node-kit
*/
const pkg = require('./package')
const ArgParser = require('argparse').ArgumentParser
const Build = require('./lib/build')
const Watch = require('./lib/watch')
const Update = require('./lib/update')
const builder = new Build()
const watcher = new Watch()
const updater = new Update()
const parser = new ArgParser({
description: 'Phaser Node Kit',
version: pkg.version,
allowAbbrev: false,
epilog: '(c)2017 develephant.com'
})
parser.addArgument('action', {
help: 'Phaser Node Kit Actions',
choices: [
'init',
'watch',
'sync',
'update'
]
})
const args = parser.parseArgs()
if (args.action === 'sync') {
builder.runInitBuild(true)
} else if (args.action === 'watch') {
watcher.run()
} else if (args.action === 'init') {
builder.runInitBuild()
} else if (args.action === 'update') {
updater.run()
}