UNPKG

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