release-it 0.0.0-pl.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +421 -0
  3. package/bin/release-it.js +42 -0
  4. package/config/release-it.json +70 -0
  5. package/lib/cli.js +44 -0
  6. package/lib/config.js +139 -0
  7. package/lib/index.js +152 -0
  8. package/lib/log.js +69 -0
  9. package/lib/plugin/GitBase.js +125 -0
  10. package/lib/plugin/GitRelease.js +58 -0
  11. package/lib/plugin/Plugin.js +73 -0
  12. package/lib/plugin/factory.js +89 -0
  13. package/lib/plugin/git/Git.js +220 -0
  14. package/lib/plugin/git/prompts.js +19 -0
  15. package/lib/plugin/github/GitHub.js +403 -0
  16. package/lib/plugin/github/prompts.js +16 -0
  17. package/lib/plugin/github/util.js +39 -0
  18. package/lib/plugin/gitlab/GitLab.js +277 -0
  19. package/lib/plugin/gitlab/prompts.js +9 -0
  20. package/lib/plugin/npm/npm.js +281 -0
  21. package/lib/plugin/npm/prompts.js +12 -0
  22. package/lib/plugin/version/Version.js +129 -0
  23. package/lib/prompt.js +33 -0
  24. package/lib/shell.js +91 -0
  25. package/lib/spinner.js +29 -0
  26. package/lib/util.js +109 -0
  27. package/package.json +122 -0
  28. package/test/cli.js +20 -0
  29. package/test/config.js +144 -0
  30. package/test/git.init.js +250 -0
  31. package/test/git.js +358 -0
  32. package/test/github.js +487 -0
  33. package/test/gitlab.js +252 -0
  34. package/test/log.js +143 -0
  35. package/test/npm.js +417 -0
  36. package/test/plugin-name.js +9 -0
  37. package/test/plugins.js +238 -0
  38. package/test/prompt.js +97 -0
  39. package/test/resources/file-v2.0.1.txt +1 -0
  40. package/test/resources/file-v2.0.2.txt +1 -0
  41. package/test/resources/file1 +1 -0
  42. package/test/shell.js +74 -0
  43. package/test/spinner.js +58 -0
  44. package/test/stub/config/default/.release-it.json +5 -0
  45. package/test/stub/config/invalid-config-rc +1 -0
  46. package/test/stub/config/invalid-config-txt +2 -0
  47. package/test/stub/config/merge/.release-it.json +5 -0
  48. package/test/stub/config/merge/package.json +7 -0
  49. package/test/stub/config/toml/.release-it.toml +2 -0
  50. package/test/stub/config/yaml/.release-it.yaml +2 -0
  51. package/test/stub/config/yml/.release-it.yml +2 -0
  52. package/test/stub/github.js +130 -0
  53. package/test/stub/gitlab.js +44 -0
  54. package/test/stub/plugin-context.js +36 -0
  55. package/test/stub/plugin-replace.js +9 -0
  56. package/test/stub/plugin.js +39 -0
  57. package/test/stub/shell.js +24 -0
  58. package/test/tasks.interactive.js +208 -0
  59. package/test/tasks.js +585 -0
  60. package/test/util/helpers.js +32 -0
  61. package/test/util/index.js +78 -0
  62. package/test/util/setup.js +5 -0
  63. package/test/utils.js +97 -0
  64. package/test/version.js +173 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Lars Kappert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,421 @@
1
+ # Release It! 🚀
2
+
3
+ 🚀 Generic CLI tool to automate versioning and package publishing-related tasks:
4
+
5
+ <img align="right" src="./docs/assets/release-it.svg?raw=true" height="280">
6
+
7
+ - Bump version (in e.g. `package.json`)
8
+ - [Git commit, tag, push][1]
9
+ - Execute any (test or build) commands using [hooks][2]
10
+ - [Create release at GitHub][3] or [GitLab][4]
11
+ - [Generate changelog][5]
12
+ - [Publish to npm][6]
13
+ - [Manage pre-releases][7]
14
+ - Extend with [plugins][8]
15
+ - Release from any [CI/CD environment][9]
16
+
17
+ Use release-it for version management and publish to anywhere with its versatile configuration, a powerful plugin
18
+ system, and hooks to execute any command you need to test, build, and/or publish your project.
19
+
20
+ [![Action Status][11]][10] [![npm version][13]][12]
21
+
22
+ ## Installation
23
+
24
+ Although release-it is a **generic** release tool, most projects use it for projects with npm packages. The recommended
25
+ way to install release-it uses npm and adds some minimal configuration to get started:
26
+
27
+ ```bash
28
+ npm init release-it
29
+ ```
30
+
31
+ Alternatively, install it manually, and add the `release` script to `package.json`:
32
+
33
+ ```bash
34
+ npm install -D release-it
35
+ ```
36
+
37
+ ```json
38
+ {
39
+ "name": "my-package",
40
+ "version": "1.0.0",
41
+ "scripts": {
42
+ "release": "release-it"
43
+ },
44
+ "devDependencies": {
45
+ "release-it": "^16.1.0"
46
+ }
47
+ }
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ Run release-it from the root of the project using either `npm run` or `npx`:
53
+
54
+ ```bash
55
+ npm run release
56
+ npx release-it
57
+ ```
58
+
59
+ You will be prompted to select the new version, and more prompts will follow based on your configuration.
60
+
61
+ ## Experimental: knowledge base
62
+
63
+ You might want to ask your questions in the [Release It! knowledge base][14] (powered by OpenAI and [7-docs][15]). This
64
+ is an experimental knowledge base, answers may be incorrect.
65
+
66
+ ## Yarn
67
+
68
+ Using Yarn? Please see the [npm section on Yarn][16].
69
+
70
+ ## Monorepos
71
+
72
+ Using a monorepo? Please see this [monorepo recipe][17].
73
+
74
+ ## Global Installation
75
+
76
+ Per-project installation as shown above is recommended, but global installs are supported as well:
77
+
78
+ - From npm: `npm install -g release-it`
79
+ - From Homebrew: `brew install release-it`
80
+
81
+ ## Videos, articles & examples
82
+
83
+ Here's a list of interesting external resources:
84
+
85
+ - Video: [How to use GitHub Actions & Release-It to Easily Release Your Code][18]
86
+ - Article: [Monorepo Semantic Releases][19] ([repo][20])
87
+
88
+ Want to add yours to the list? Just open a pull request!
89
+
90
+ ## Configuration
91
+
92
+ Out of the box, release-it has sane defaults, and [plenty of options][21] to configure it. Most projects use a
93
+ `.release-it.json` file in the project root, or a `release-it` property in `package.json`.
94
+
95
+ Here's a quick example `.release-it.json`:
96
+
97
+ ```json
98
+ {
99
+ "git": {
100
+ "commitMessage": "chore: release v${version}"
101
+ },
102
+ "github": {
103
+ "release": true
104
+ }
105
+ }
106
+ ```
107
+
108
+ → See [Configuration][22] for more details.
109
+
110
+ ## Interactive vs. CI mode
111
+
112
+ By default, release-it is **interactive** and allows you to confirm each task before execution:
113
+
114
+ <img src="./docs/assets/release-it-interactive.gif?raw=true" height="290">
115
+
116
+ By using the `--ci` option, the process is fully automated without prompts. The configured tasks will be executed as
117
+ demonstrated in the first animation above. In a Continuous Integration (CI) environment, this non-interactive mode is
118
+ activated automatically.
119
+
120
+ Use `--only-version` to use a prompt only to determine the version, and automate the rest.
121
+
122
+ ## Latest version
123
+
124
+ How does release-it determine the latest version?
125
+
126
+ 1. For projects with a `package.json`, its `version` will be used (see [npm][23] to skip this).
127
+ 2. Otherwise, release-it uses the latest Git tag to determine which version should be released.
128
+ 3. As a last resort, `0.0.0` will be used as the latest version.
129
+
130
+ Alternatively, a plugin can be used to override this (e.g. to manage a `VERSION` or `composer.json` file):
131
+
132
+ - [@release-it/bumper][24] to read from or bump the version in any file
133
+ - [@release-it/conventional-changelog][25] to get a recommended bump based on commit messages
134
+ - [release-it-calver-plugin][26] to use CalVer (Calendar Versioning)
135
+
136
+ Add the `--release-version` flag to print the **next** version without releasing anything.
137
+
138
+ ## Git
139
+
140
+ Git projects are supported well by release-it, automating the tasks to stage, commit, tag and push releases to any Git
141
+ remote.
142
+
143
+ → See [Git][27] for more details.
144
+
145
+ ## GitHub Releases
146
+
147
+ GitHub projects can have releases attached to Git tags, containing release notes and assets. There are two ways to add
148
+ [GitHub releases][28] in your release-it flow:
149
+
150
+ 1. Automated (requires a `GITHUB_TOKEN`)
151
+ 2. Manual (using the GitHub web interface with pre-populated fields)
152
+
153
+ → See [GitHub Releases][29] for more details.
154
+
155
+ ## GitLab Releases
156
+
157
+ GitLab projects can have releases attached to Git tags, containing release notes and assets. To automate [GitLab
158
+ releases][30]:
159
+
160
+ - Configure `gitlab.release: true`
161
+ - Obtain a [personal access token][31] (release-it only needs the "api" scope).
162
+ - Make sure the token is [available as an environment variable][32].
163
+
164
+ → See [GitLab Releases][33] for more details.
165
+
166
+ ## Changelog
167
+
168
+ By default, release-it generates a changelog, to show and help select a version for the new release. Additionally, this
169
+ changelog serves as the release notes for the GitHub or GitLab release.
170
+
171
+ The [default command][21] is based on `git log ...`. This setting (`git.changelog`) can be overridden. To further
172
+ customize the release notes for the GitHub or GitLab release, there's `github.releaseNotes` or `gitlab.releaseNotes`.
173
+ Make sure any of these commands output the changelog to `stdout`. Note that release-it by default is agnostic to commit
174
+ message conventions. Plugins are available for:
175
+
176
+ - GitHub and GitLab Releases
177
+ - auto-changelog
178
+ - Conventional Changelog
179
+ - Keep A Changelog
180
+
181
+ To print the changelog without releasing anything, add the `--changelog` flag.
182
+
183
+ → See [Changelog][34] for more details.
184
+
185
+ ## Publish to npm
186
+
187
+ With a `package.json` in the current directory, release-it will let `npm` bump the version in `package.json` (and
188
+ `package-lock.json` if present), and publish to the npm registry.
189
+
190
+ → See [Publish to npm][23] for more details.
191
+
192
+ ## Manage pre-releases
193
+
194
+ With release-it, it's easy to create pre-releases: a version of your software that you want to make available, while
195
+ it's not in the stable semver range yet. Often "alpha", "beta", and "rc" (release candidate) are used as identifiers for
196
+ pre-releases. An example pre-release version is `2.0.0-beta.0`.
197
+
198
+ → See [Manage pre-releases][35] for more details.
199
+
200
+ ## Update or re-run existing releases
201
+
202
+ Use `--no-increment` to not increment the last version, but update the last existing tag/version.
203
+
204
+ This may be helpful in cases where the version was already incremented. Here are a few example scenarios:
205
+
206
+ - To update or publish a (draft) GitHub Release for an existing Git tag.
207
+ - Publishing to npm succeeded, but pushing the Git tag to the remote failed. Then use
208
+ `release-it --no-increment --no-npm` to skip the `npm publish` and try pushing the same Git tag again.
209
+
210
+ ## Hooks
211
+
212
+ Use script hooks to run shell commands at any moment during the release process (such as `before:init` or
213
+ `after:release`).
214
+
215
+ The format is `[prefix]:[hook]` or `[prefix]:[plugin]:[hook]`:
216
+
217
+ | part | value |
218
+ | ------ | ------------------------------------------- |
219
+ | prefix | `before` or `after` |
220
+ | plugin | `version`, `git`, `npm`, `github`, `gitlab` |
221
+ | hook | `init`, `bump`, `release` |
222
+
223
+ Use the optional `:plugin` part in the middle to hook into a life cycle method exactly before or after any plugin.
224
+
225
+ The core plugins include `version`, `git`, `npm`, `github`, `gitlab`.
226
+
227
+ Note that hooks like `after:git:release` will not run when either the `git push` failed, or when it is configured not to
228
+ be executed (e.g. `git.push: false`). See [execution order][36] for more details on execution order of plugin lifecycle
229
+ methods.
230
+
231
+ All commands can use configuration variables (like template strings). An array of commands can also be provided, they
232
+ will run one after another. Some example release-it configuration:
233
+
234
+ ```json
235
+ {
236
+ "hooks": {
237
+ "before:init": ["npm run lint", "npm test"],
238
+ "after:my-plugin:bump": "./bin/my-script.sh",
239
+ "after:bump": "npm run build",
240
+ "after:git:release": "echo After git push, before github release",
241
+ "after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
242
+ }
243
+ }
244
+ ```
245
+
246
+ The variables can be found in the [default configuration][21]. Additionally, the following variables are exposed:
247
+
248
+ ```text
249
+ version
250
+ latestVersion
251
+ changelog
252
+ name
253
+ repo.remote, repo.protocol, repo.host, repo.owner, repo.repository, repo.project
254
+ branchName
255
+ releaseUrl
256
+ ```
257
+
258
+ All variables are available in all hooks. The only exception is that the additional variables listed above are not yet
259
+ available in the `init` hook.
260
+
261
+ Use `--verbose` to log the output of the commands.
262
+
263
+ For the sake of verbosity, the full list of hooks is actually: `init`, `beforeBump`, `bump`, `beforeRelease`, `release`
264
+ or `afterRelease`. However, hooks like `before:beforeRelease` look weird and are usually not useful in practice.
265
+
266
+ Note that arguments need to be quoted properly when used from the command line:
267
+
268
+ ```bash
269
+ release-it --'hooks.after:release="echo Successfully released ${name} v${version} to ${repo.repository}."'
270
+ ```
271
+
272
+ Using Inquirer.js inside custom hook scripts might cause issues (since release-it also uses this itself).
273
+
274
+ ## Dry Runs
275
+
276
+ Use `--dry-run` to show the interactivity and the commands it _would_ execute.
277
+
278
+ → See [Dry Runs][37] for more details.
279
+
280
+ ## Troubleshooting & debugging
281
+
282
+ - With `release-it --verbose` (or `-V`), release-it prints the output of every user-defined [hook][2].
283
+ - With `release-it -VV`, release-it also prints the output of every internal command.
284
+ - Use `NODE_DEBUG=release-it:* release-it [...]` to print configuration and more error details.
285
+
286
+ Use `verbose: 2` in a configuration file to have the equivalent of `-VV` on the command line.
287
+
288
+ ## Plugins
289
+
290
+ Since v11, release-it can be extended in many, many ways. Here are some plugins:
291
+
292
+ | Plugin | Description |
293
+ | ----------------------------------------- | ----------------------------------------------------------------------------- |
294
+ | [@release-it/bumper][24] | Read & write the version from/to any file |
295
+ | [@release-it/conventional-changelog][25] | Provides recommended bump, conventional-changelog, and updates `CHANGELOG.md` |
296
+ | [@release-it/keep-a-changelog][38] | Maintain CHANGELOG.md using the Keep a Changelog standards |
297
+ | [@release-it-plugins/lerna-changelog][39] | Integrates lerna-changelog into the release-it pipeline |
298
+ | [@release-it-plugins/workspaces][40] | Releases each of your projects configured workspaces |
299
+ | [release-it-calver-plugin][26] | Enables Calendar Versioning (calver) with release-it |
300
+ | [@grupoboticario/news-fragments][41] | An easy way to generate your changelog file |
301
+ | [@j-ulrich/release-it-regex-bumper][42] | Regular expression based version read/write plugin for release-it |
302
+
303
+ Internally, release-it uses its own plugin architecture (for Git, GitHub, GitLab, npm).
304
+
305
+ → See all [release-it plugins on npm][43].
306
+
307
+ → See [plugins][44] for documentation to write plugins.
308
+
309
+ ## Use release-it programmatically
310
+
311
+ While mostly used as a CLI tool, release-it can be used as a dependency to integrate in your own scripts. See [use
312
+ release-it programmatically][45] for example code.
313
+
314
+ ## Example projects using release-it
315
+
316
+ - [axios/axios][46]
317
+ - [blockchain/blockchain-wallet-v4-frontend][47]
318
+ - [callstack/react-native-paper][48]
319
+ - [ember-cli/ember-cli][49]
320
+ - [js-cookie/js-cookie][50]
321
+ - [metalsmith/metalsmith][51]
322
+ - [mozilla/readability][52]
323
+ - [pahen/madge][53]
324
+ - [redis/node-redis][54]
325
+ - [reduxjs/redux][55]
326
+ - [saleor/saleor][56]
327
+ - [Semantic-Org/Semantic-UI-React][57]
328
+ - [shipshapecode/shepherd][58]
329
+ - [StevenBlack/hosts][59]
330
+ - [swagger-api/swagger-ui][60] + [swagger-editor][61]
331
+ - [tabler/tabler][62] + [tabler-icons][63]
332
+ - [youzan/vant][64]
333
+ - [Repositories that depend on release-it][65]
334
+ - GitHub search for [path:\*\*/.release-it.json][66]
335
+
336
+ ## Legacy Node.js
337
+
338
+ The latest major version is v16, supporting Node.js 16 and up (as Node.js v14 is EOL). Use release-it v15 for
339
+ environments running Node.js v14. Also see [CHANGELOG.md][67].
340
+
341
+ ## Links
342
+
343
+ - See [CHANGELOG.md][67] for major/breaking updates, and [releases][68] for a detailed version history.
344
+ - To **contribute**, please read [CONTRIBUTING.md][69] first.
345
+ - Please [open an issue][70] if anything is missing or unclear in this documentation.
346
+
347
+ ## License
348
+
349
+ [MIT][71]
350
+
351
+ [1]: #git
352
+ [2]: #hooks
353
+ [3]: #github-releases
354
+ [4]: #gitlab-releases
355
+ [5]: #changelog
356
+ [6]: #publish-to-npm
357
+ [7]: #manage-pre-releases
358
+ [8]: #plugins
359
+ [9]: ./docs/ci.md
360
+ [10]: https://github.com/release-it/release-it/actions
361
+ [11]: https://github.com/release-it/release-it/workflows/Cross-OS%20Tests/badge.svg
362
+ [12]: https://www.npmjs.com/package/release-it
363
+ [13]: https://badge.fury.io/js/release-it.svg
364
+ [14]: https://release-it.deno.dev
365
+ [15]: https://github.com/7-docs/7-docs
366
+ [16]: ./docs/npm.md#yarn
367
+ [17]: ./docs/recipes/monorepo.md
368
+ [18]: https://www.youtube.com/watch?v=7pBcuT7j_A0
369
+ [19]: https://medium.com/valtech-ch/monorepo-semantic-releases-db114811efa5
370
+ [20]: https://github.com/b12k/monorepo-semantic-releases
371
+ [21]: ./config/release-it.json
372
+ [22]: ./docs/configuration.md
373
+ [23]: ./docs/npm.md
374
+ [24]: https://github.com/release-it/bumper
375
+ [25]: https://github.com/release-it/conventional-changelog
376
+ [26]: https://github.com/casmith/release-it-calver-plugin
377
+ [27]: ./docs/git.md
378
+ [28]: https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases
379
+ [29]: ./docs/github-releases.md
380
+ [30]: https://docs.gitlab.com/ce/user/project/releases/
381
+ [31]: https://gitlab.com/profile/personal_access_tokens
382
+ [32]: ./docs/environment-variables.md
383
+ [33]: ./docs/gitlab-releases.md
384
+ [34]: ./docs/changelog.md
385
+ [35]: ./docs/pre-releases.md
386
+ [36]: ./docs/plugins.md#execution-order
387
+ [37]: ./docs/dry-runs.md
388
+ [38]: https://github.com/release-it/keep-a-changelog
389
+ [39]: https://github.com/release-it-plugins/lerna-changelog
390
+ [40]: https://github.com/release-it-plugins/workspaces
391
+ [41]: https://github.com/grupoboticario/news-fragments
392
+ [42]: https://github.com/j-ulrich/release-it-regex-bumper
393
+ [43]: https://www.npmjs.com/search?q=keywords:release-it-plugin
394
+ [44]: ./docs/plugins.md
395
+ [45]: ./docs/recipes/programmatic.md
396
+ [46]: https://github.com/axios/axios
397
+ [47]: https://github.com/blockchain/blockchain-wallet-v4-frontend
398
+ [48]: https://github.com/callstack/react-native-paper
399
+ [49]: https://github.com/ember-cli/ember-cli
400
+ [50]: https://github.com/js-cookie/js-cookie
401
+ [51]: https://github.com/metalsmith/metalsmith
402
+ [52]: https://github.com/mozilla/readability
403
+ [53]: https://github.com/pahen/madge
404
+ [54]: https://github.com/redis/node-redis
405
+ [55]: https://github.com/reduxjs/redux
406
+ [56]: https://github.com/saleor/saleor
407
+ [57]: https://github.com/Semantic-Org/Semantic-UI-React
408
+ [58]: https://github.com/shipshapecode/shepherd
409
+ [59]: https://github.com/StevenBlack/hosts
410
+ [60]: https://github.com/swagger-api/swagger-ui
411
+ [61]: https://github.com/swagger-api/swagger-editor
412
+ [62]: https://github.com/tabler/tabler
413
+ [63]: https://github.com/tabler/tabler-icons
414
+ [64]: https://github.com/youzan/vant
415
+ [65]: https://github.com/release-it/release-it/network/dependents
416
+ [66]: https://github.com/search?q=path%3A**%2F.release-it.json&type=code
417
+ [67]: ./CHANGELOG.md
418
+ [68]: https://github.com/release-it/release-it/releases
419
+ [69]: ./.github/CONTRIBUTING.md
420
+ [70]: https://github.com/release-it/release-it/issues/new
421
+ [71]: ./LICENSE
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+
3
+ import updater from 'update-notifier';
4
+ import parseArgs from 'yargs-parser';
5
+ import release from '../lib/cli.js';
6
+ import { readJSON } from '../lib/util.js';
7
+
8
+ const pkg = readJSON(new URL('../package.json', import.meta.url));
9
+
10
+ const aliases = {
11
+ c: 'config',
12
+ d: 'dry-run',
13
+ h: 'help',
14
+ i: 'increment',
15
+ v: 'version',
16
+ V: 'verbose'
17
+ };
18
+
19
+ const parseCliArguments = args => {
20
+ const options = parseArgs(args, {
21
+ boolean: ['dry-run', 'ci'],
22
+ alias: aliases,
23
+ configuration: {
24
+ 'parse-numbers': false,
25
+ 'camel-case-expansion': false
26
+ }
27
+ });
28
+ if (options.V) {
29
+ options.verbose = typeof options.V === 'boolean' ? options.V : options.V.length;
30
+ delete options.V;
31
+ }
32
+ options.increment = options._[0] || options.i;
33
+ return options;
34
+ };
35
+
36
+ const options = parseCliArguments([].slice.call(process.argv, 2));
37
+
38
+ updater({ pkg: pkg }).notify();
39
+ release(options).then(
40
+ () => process.exit(0),
41
+ ({ code }) => process.exit(Number.isInteger(code) ? code : 1)
42
+ );
@@ -0,0 +1,70 @@
1
+ {
2
+ "hooks": {},
3
+ "git": {
4
+ "changelog": "git log --pretty=format:\"* %s (%h)\" ${from}...${to}",
5
+ "requireCleanWorkingDir": true,
6
+ "requireBranch": false,
7
+ "requireUpstream": true,
8
+ "requireCommits": false,
9
+ "requireCommitsFail": true,
10
+ "commitsPath": "",
11
+ "addUntrackedFiles": false,
12
+ "commit": true,
13
+ "commitMessage": "Release ${version}",
14
+ "commitArgs": [],
15
+ "tag": true,
16
+ "tagExclude": null,
17
+ "tagName": null,
18
+ "tagMatch": null,
19
+ "getLatestTagFromAllRefs": false,
20
+ "tagAnnotation": "Release ${version}",
21
+ "tagArgs": [],
22
+ "push": true,
23
+ "pushArgs": ["--follow-tags"],
24
+ "pushRepo": ""
25
+ },
26
+ "npm": {
27
+ "publish": true,
28
+ "publishPath": ".",
29
+ "publishArgs": [],
30
+ "tag": null,
31
+ "otp": null,
32
+ "ignoreVersion": false,
33
+ "allowSameVersion": false,
34
+ "versionArgs": [],
35
+ "skipChecks": false,
36
+ "timeout": 10
37
+ },
38
+ "github": {
39
+ "release": false,
40
+ "releaseName": "Release ${version}",
41
+ "releaseNotes": null,
42
+ "autoGenerate": false,
43
+ "preRelease": false,
44
+ "draft": false,
45
+ "tokenRef": "GITHUB_TOKEN",
46
+ "assets": null,
47
+ "host": null,
48
+ "timeout": 0,
49
+ "proxy": null,
50
+ "skipChecks": false,
51
+ "web": false,
52
+ "comments": {
53
+ "submit": false,
54
+ "issue": ":rocket: _This issue has been resolved in v${version}. See [${releaseName}](${releaseUrl}) for release notes._",
55
+ "pr": ":rocket: _This pull request is included in v${version}. See [${releaseName}](${releaseUrl}) for release notes._"
56
+ }
57
+ },
58
+ "gitlab": {
59
+ "release": false,
60
+ "releaseName": "Release ${version}",
61
+ "releaseNotes": null,
62
+ "milestones": [],
63
+ "tokenRef": "GITLAB_TOKEN",
64
+ "tokenHeader": "Private-Token",
65
+ "certificateAuthorityFile": null,
66
+ "assets": null,
67
+ "origin": null,
68
+ "skipChecks": false
69
+ }
70
+ }
package/lib/cli.js ADDED
@@ -0,0 +1,44 @@
1
+ import { readJSON } from './util.js';
2
+ import Log from './log.js';
3
+ import runTasks from './index.js';
4
+
5
+ const pkg = readJSON(new URL('../package.json', import.meta.url));
6
+
7
+ const log = new Log();
8
+
9
+ const helpText = `Release It! v${pkg.version}
10
+
11
+ Usage: release-it <increment> [options]
12
+
13
+ Use e.g. "release-it minor" directly as shorthand for "release-it --increment=minor".
14
+
15
+ -c --config Path to local configuration options [default: ".release-it.json"]
16
+ -d --dry-run Do not touch or write anything, but show the commands
17
+ -h --help Print this help
18
+ -i --increment Increment "major", "minor", "patch", or "pre*" version; or specify version [default: "patch"]
19
+ --ci No prompts, no user interaction; activated automatically in CI environments
20
+ --only-version Prompt only for version, no further interaction
21
+ -v --version Print release-it version number
22
+ --release-version Print version number to be released
23
+ --changelog Print changelog for the version to be released
24
+ -V --verbose Verbose output (user hooks output)
25
+ -VV Extra verbose output (also internal commands output)
26
+
27
+ For more details, please see https://github.com/release-it/release-it`;
28
+
29
+ /** @internal */
30
+ export const version = () => log.log(`v${pkg.version}`);
31
+
32
+ /** @internal */
33
+ export const help = () => log.log(helpText);
34
+
35
+ export default async options => {
36
+ if (options.version) {
37
+ version();
38
+ } else if (options.help) {
39
+ help();
40
+ } else {
41
+ return runTasks(options);
42
+ }
43
+ return Promise.resolve();
44
+ };