-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
executable file
·46 lines (38 loc) · 991 Bytes
/
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
45
46
#!/usr/bin/env node
const program = require('commander');
const pkg = require('./package.json');
const diff = require('./tasks/diff');
const snapshot = require('./tasks/snapshot');
// Take snapshot
program
.command('snapshot')
.option(
'-o, --output <path>',
'output filepath (default: "harold_snapshot_<date>_<time>.json")',
)
.option(
'-e, --exec <cmd>',
'build command (will be run with NO_HASH=true env variable set)',
'npm run build-production',
)
.option(
'-p, --path <path>',
'build path',
'public',
)
.description('build project and take snapshot')
.action(snapshot);
// Compare snapshots
program
.command('diff <left> <right>')
.description('compare snapshots')
.action(diff);
program
.usage('[options]')
.version(pkg.version, '-V, --version')
.description(pkg.description)
.parse(process.argv);
if (!program.args.length) program.help();
process.on('unhandledRejection', error => {
console.error(error);
});