|
1 |
| -const spec = require('conventional-changelog-config-spec') |
2 |
| -const { getConfiguration } = require('./lib/configuration') |
3 |
| -const defaults = require('./defaults') |
| 1 | +const spec = require('conventional-changelog-config-spec'); |
| 2 | +const { getConfiguration } = require('./lib/configuration'); |
| 3 | +const defaults = require('./defaults'); |
4 | 4 |
|
5 | 5 | const yargs = require('yargs')
|
6 | 6 | .usage('Usage: $0 [options]')
|
7 | 7 | .option('packageFiles', {
|
8 | 8 | default: defaults.packageFiles,
|
9 |
| - array: true |
| 9 | + array: true, |
10 | 10 | })
|
11 | 11 | .option('bumpFiles', {
|
12 | 12 | default: defaults.bumpFiles,
|
13 |
| - array: true |
| 13 | + array: true, |
14 | 14 | })
|
15 | 15 | .option('release-as', {
|
16 | 16 | alias: 'r',
|
17 | 17 | describe:
|
18 | 18 | 'Specify the release type manually (like npm version <major|minor|patch>)',
|
19 | 19 | requiresArg: true,
|
20 |
| - string: true |
| 20 | + string: true, |
21 | 21 | })
|
22 | 22 | .option('prerelease', {
|
23 | 23 | alias: 'p',
|
24 | 24 | describe:
|
25 | 25 | 'make a pre-release with optional option value to specify a tag id',
|
26 |
| - string: true |
| 26 | + string: true, |
27 | 27 | })
|
28 | 28 | .option('infile', {
|
29 | 29 | alias: 'i',
|
30 | 30 | describe: 'Read the CHANGELOG from this file',
|
31 |
| - default: defaults.infile |
| 31 | + default: defaults.infile, |
32 | 32 | })
|
33 | 33 | .option('message', {
|
34 | 34 | alias: ['m'],
|
35 | 35 | describe:
|
36 | 36 | '[DEPRECATED] Commit message, replaces %s with new version.\nThis option will be removed in the next major version, please use --releaseCommitMessageFormat.',
|
37 |
| - type: 'string' |
| 37 | + type: 'string', |
38 | 38 | })
|
39 | 39 | .option('first-release', {
|
40 | 40 | alias: 'f',
|
41 | 41 | describe: 'Is this the first release?',
|
42 | 42 | type: 'boolean',
|
43 |
| - default: defaults.firstRelease |
| 43 | + default: defaults.firstRelease, |
44 | 44 | })
|
45 | 45 | .option('sign', {
|
46 | 46 | alias: 's',
|
47 | 47 | describe: 'Should the git commit and tag be signed?',
|
48 | 48 | type: 'boolean',
|
49 |
| - default: defaults.sign |
| 49 | + default: defaults.sign, |
50 | 50 | })
|
51 | 51 | .option('no-verify', {
|
52 | 52 | alias: 'n',
|
53 | 53 | describe:
|
54 | 54 | 'Bypass pre-commit or commit-msg git hooks during the commit phase',
|
55 | 55 | type: 'boolean',
|
56 |
| - default: defaults.noVerify |
| 56 | + default: defaults.noVerify, |
57 | 57 | })
|
58 | 58 | .option('commit-all', {
|
59 | 59 | alias: 'a',
|
60 | 60 | describe:
|
61 | 61 | 'Commit all staged changes, not just files affected by commit-and-tag-version',
|
62 | 62 | type: 'boolean',
|
63 |
| - default: defaults.commitAll |
| 63 | + default: defaults.commitAll, |
64 | 64 | })
|
65 | 65 | .option('silent', {
|
66 | 66 | describe: "Don't print logs and errors",
|
67 | 67 | type: 'boolean',
|
68 |
| - default: defaults.silent |
| 68 | + default: defaults.silent, |
69 | 69 | })
|
70 | 70 | .option('tag-prefix', {
|
71 | 71 | alias: 't',
|
72 | 72 | describe: 'Set a custom prefix for the git tag to be created',
|
73 | 73 | type: 'string',
|
74 |
| - default: defaults.tagPrefix |
| 74 | + default: defaults.tagPrefix, |
75 | 75 | })
|
76 | 76 | .option('release-count', {
|
77 |
| - describe: 'How many releases of changelog you want to generate. It counts from the upcoming release. Useful when you forgot to generate any previous changelog. Set to 0 to regenerate all.', |
| 77 | + describe: |
| 78 | + 'How many releases of changelog you want to generate. It counts from the upcoming release. Useful when you forgot to generate any previous changelog. Set to 0 to regenerate all.', |
78 | 79 | type: 'number',
|
79 |
| - default: defaults.releaseCount |
| 80 | + default: defaults.releaseCount, |
80 | 81 | })
|
81 | 82 | .option('tag-force', {
|
82 | 83 | describe: 'Allow tag replacement',
|
83 | 84 | type: 'boolean',
|
84 |
| - default: defaults.tagForce |
| 85 | + default: defaults.tagForce, |
85 | 86 | })
|
86 | 87 | .option('scripts', {
|
87 | 88 | describe:
|
88 | 89 | 'Provide scripts to execute for lifecycle events (prebump, precommit, etc.,)',
|
89 |
| - default: defaults.scripts |
| 90 | + default: defaults.scripts, |
90 | 91 | })
|
91 | 92 | .option('skip', {
|
92 | 93 | describe: 'Map of steps in the release process that should be skipped',
|
93 |
| - default: defaults.skip |
| 94 | + default: defaults.skip, |
94 | 95 | })
|
95 | 96 | .option('dry-run', {
|
96 | 97 | type: 'boolean',
|
97 | 98 | default: defaults.dryRun,
|
98 |
| - describe: 'See the commands that running commit-and-tag-version would run' |
| 99 | + describe: 'See the commands that running commit-and-tag-version would run', |
99 | 100 | })
|
100 | 101 | .option('git-tag-fallback', {
|
101 | 102 | type: 'boolean',
|
102 | 103 | default: defaults.gitTagFallback,
|
103 | 104 | describe:
|
104 |
| - 'fallback to git tags for version, if no meta-information file is found (e.g., package.json)' |
| 105 | + 'fallback to git tags for version, if no meta-information file is found (e.g., package.json)', |
105 | 106 | })
|
106 | 107 | .option('path', {
|
107 | 108 | type: 'string',
|
108 |
| - describe: 'Only populate commits made under this path' |
| 109 | + describe: 'Only populate commits made under this path', |
109 | 110 | })
|
110 | 111 | .option('changelogHeader', {
|
111 | 112 | type: 'string',
|
112 | 113 | describe:
|
113 |
| - '[DEPRECATED] Use a custom header when generating and updating changelog.\nThis option will be removed in the next major version, please use --header.' |
| 114 | + '[DEPRECATED] Use a custom header when generating and updating changelog.\nThis option will be removed in the next major version, please use --header.', |
114 | 115 | })
|
115 | 116 | .option('preset', {
|
116 | 117 | type: 'string',
|
117 | 118 | default: defaults.preset,
|
118 |
| - describe: 'Commit message guideline preset' |
| 119 | + describe: 'Commit message guideline preset', |
119 | 120 | })
|
120 | 121 | .option('lerna-package', {
|
121 | 122 | type: 'string',
|
122 |
| - describe: 'Name of the package from which the tags will be extracted' |
| 123 | + describe: 'Name of the package from which the tags will be extracted', |
123 | 124 | })
|
124 | 125 | .option('npmPublishHint', {
|
125 | 126 | type: 'string',
|
126 | 127 | default: defaults.npmPublishHint,
|
127 |
| - describe: 'Customized publishing hint' |
| 128 | + describe: 'Customized publishing hint', |
128 | 129 | })
|
129 | 130 | .check((argv) => {
|
130 | 131 | if (typeof argv.scripts !== 'object' || Array.isArray(argv.scripts)) {
|
131 |
| - throw Error('scripts must be an object') |
| 132 | + throw Error('scripts must be an object'); |
132 | 133 | } else if (typeof argv.skip !== 'object' || Array.isArray(argv.skip)) {
|
133 |
| - throw Error('skip must be an object') |
| 134 | + throw Error('skip must be an object'); |
134 | 135 | } else {
|
135 |
| - return true |
| 136 | + return true; |
136 | 137 | }
|
137 | 138 | })
|
138 | 139 | .alias('version', 'v')
|
139 | 140 | .alias('help', 'h')
|
140 | 141 | .example('$0', 'Update changelog and tag release')
|
141 | 142 | .example(
|
142 | 143 | '$0 -m "%s: see changelog for details"',
|
143 |
| - 'Update changelog and tag release with custom commit message' |
| 144 | + 'Update changelog and tag release with custom commit message', |
144 | 145 | )
|
145 | 146 | .pkgConf('standard-version')
|
146 | 147 | .pkgConf('commit-and-tag-version')
|
147 | 148 | .config(getConfiguration())
|
148 |
| - .wrap(97) |
| 149 | + .wrap(97); |
149 | 150 |
|
150 | 151 | Object.keys(spec.properties).forEach((propertyKey) => {
|
151 |
| - const property = spec.properties[propertyKey] |
| 152 | + const property = spec.properties[propertyKey]; |
152 | 153 | yargs.option(propertyKey, {
|
153 | 154 | type: property.type,
|
154 | 155 | describe: property.description,
|
155 | 156 | default: defaults[propertyKey] ? defaults[propertyKey] : property.default,
|
156 |
| - group: 'Preset Configuration:' |
157 |
| - }) |
158 |
| -}) |
| 157 | + group: 'Preset Configuration:', |
| 158 | + }); |
| 159 | +}); |
159 | 160 |
|
160 |
| -module.exports = yargs |
| 161 | +module.exports = yargs; |
0 commit comments