-
-
Notifications
You must be signed in to change notification settings - Fork 511
/
release-it.js
executable file
路42 lines (36 loc) 路 1001 Bytes
/
release-it.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
#!/usr/bin/env node
import updater from 'update-notifier';
import parseArgs from 'yargs-parser';
import release from '../lib/cli.js';
import { readJSON } from '../lib/util.js';
const pkg = readJSON(new URL('../package.json', import.meta.url));
const aliases = {
c: 'config',
d: 'dry-run',
h: 'help',
i: 'increment',
v: 'version',
V: 'verbose'
};
const parseCliArguments = args => {
const options = parseArgs(args, {
boolean: ['dry-run', 'ci'],
alias: aliases,
configuration: {
'parse-numbers': false,
'camel-case-expansion': false
}
});
if (options.V) {
options.verbose = typeof options.V === 'boolean' ? options.V : options.V.length;
delete options.V;
}
options.increment = options._[0] || options.i;
return options;
};
const options = parseCliArguments([].slice.call(process.argv, 2));
updater({ pkg: pkg }).notify();
release(options).then(
() => process.exit(0),
({ code }) => process.exit(Number.isInteger(code) ? code : 1)
);