UNPKG

846 BJavaScriptView Raw
1#!/usr/bin/env node
2
3const updater = require('update-notifier');
4const pkg = require('../package.json');
5const parseArgs = require('yargs-parser');
6const release = require('../lib');
7
8const 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
18const 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
34const options = parseCliArguments([].slice.call(process.argv, 2));
35
36updater({ pkg: pkg }).notify();
37release(options).then(() => process.exit(0), () => process.exit(1));