-
-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy pathlicia.js
executable file
·60 lines (53 loc) · 1.15 KB
/
licia.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
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env node
const path = require('path');
const { contain, parseArgs } = require('licia');
const options = parseArgs(process.argv.slice(2), {
names: {
browser: 'boolean',
docker: 'boolean',
silent: 'boolean',
all: 'boolean',
sauce: 'boolean',
ts: 'boolean',
release: 'boolean'
},
shorthands: {
browser: 'b',
docker: 'd',
silent: 's',
all: 'a',
release: 'r'
}
});
const remain = options.remain;
process.chdir(path.resolve(__dirname, '../'));
global.options = options;
const cmd = remain[0];
const LEGAL_COMMANDS = [
'test',
'build',
'update',
'benchmark',
'help',
'format',
'lint',
'demo',
'spell'
];
(async () => {
if (!contain(LEGAL_COMMANDS, cmd)) {
await require('../lib/help')();
} else {
remain.splice(0, 1);
try {
await require('../lib/' + cmd)();
} catch (e) {
if (e.exitCode) {
process.exit(e.exitCode);
} else {
console.error(e);
process.exit(1);
}
}
}
})();