1 | #!/usr/bin/env node
|
2 |
|
3 | const updater = require('update-notifier');
|
4 | const pkg = require('../package.json');
|
5 | const parseArgs = require('yargs-parser');
|
6 | const release = require('../lib');
|
7 |
|
8 | const aliases = {
|
9 | c: 'config',
|
10 | d: 'dry-run',
|
11 | h: 'help',
|
12 | i: 'increment',
|
13 | n: 'non-interactive',
|
14 | v: 'version',
|
15 | V: 'verbose'
|
16 | };
|
17 |
|
18 | const parseCliArguments = args => {
|
19 | const options = parseArgs(args, {
|
20 | boolean: ['dry-run', 'ci', 'non-interactive', 'verbose'],
|
21 | alias: aliases,
|
22 | default: {
|
23 | 'dry-run': false,
|
24 | verbose: false
|
25 | },
|
26 | configuration: {
|
27 | 'parse-numbers': false
|
28 | }
|
29 | });
|
30 | options.increment = options._[0] || options.i;
|
31 | return options;
|
32 | };
|
33 |
|
34 | const options = parseCliArguments([].slice.call(process.argv, 2));
|
35 |
|
36 | updater({ pkg: pkg }).notify();
|
37 | release(options).then(() => process.exit(0), () => process.exit(1));
|