release-it 14.14.0 → 14.14.3
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.
- package/README.md +17 -15
- package/lib/plugin/GitRelease.js +1 -1
- package/lib/plugin/github/GitHub.js +2 -1
- package/lib/plugin/gitlab/GitLab.js +8 -6
- package/package.json +13 -8
- package/test/git.init.js +19 -7
- package/test/github.js +1 -0
package/README.md
CHANGED
|
@@ -156,7 +156,8 @@ remote.
|
|
|
156
156
|
## GitHub Releases
|
|
157
157
|
|
|
158
158
|
GitHub projects can have releases attached to Git tags, containing release notes and assets. There are two ways to add
|
|
159
|
-
[GitHub releases](https://
|
|
159
|
+
[GitHub releases](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases) in your
|
|
160
|
+
release-it flow:
|
|
160
161
|
|
|
161
162
|
1. Automated (requires a `GITHUB_TOKEN`)
|
|
162
163
|
2. Manual (using the GitHub web interface with pre-populated fields)
|
|
@@ -255,7 +256,7 @@ will run one after another. Some example release-it configuration:
|
|
|
255
256
|
The variables can be found in the [default configuration](./config/release-it.json). Additionally, the following
|
|
256
257
|
variables are exposed:
|
|
257
258
|
|
|
258
|
-
```
|
|
259
|
+
```text
|
|
259
260
|
version
|
|
260
261
|
latestVersion
|
|
261
262
|
changelog
|
|
@@ -271,6 +272,14 @@ Use `--verbose` to log the output of the commands.
|
|
|
271
272
|
For the sake of verbosity, the full list of hooks is actually: `init`, `beforeBump`, `bump`, `beforeRelease`, `release`
|
|
272
273
|
or `afterRelease`. However, hooks like `before:beforeRelease` look weird and are usually not useful in practice.
|
|
273
274
|
|
|
275
|
+
Note that arguments need to be quoted properly when used from the command line:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
release-it --'hooks.after:release="echo Successfully released ${name} v${version} to ${repo.repository}."'
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Using Inquirer.js inside custom hook scripts might cause issues (since release-it also uses this itself).
|
|
282
|
+
|
|
274
283
|
## Plugins
|
|
275
284
|
|
|
276
285
|
Since v11, release-it can be extended in many, many ways. Here are some plugins:
|
|
@@ -319,29 +328,22 @@ While mostly used as a CLI tool, release-it can be used as a dependency to integ
|
|
|
319
328
|
- [antonmedv/fx](https://github.com/antonmedv/fx)
|
|
320
329
|
- [blockchain/blockchain-wallet-v4-frontend](https://github.com/blockchain/blockchain-wallet-v4-frontend)
|
|
321
330
|
- [callstack/linaria](https://github.com/callstack/linaria)
|
|
331
|
+
- [callstack/react-native-paper](https://github.com/callstack/react-native-paper)
|
|
322
332
|
- [ember-cli/ember-cli](https://github.com/ember-cli/ember-cli)
|
|
323
|
-
- [metalsmith/metalsmith](https://github.com/metalsmith/metalsmith)
|
|
324
|
-
- [react-native-paper](https://github.com/callstack/react-native-paper)
|
|
325
333
|
- [js-cookie/js-cookie](https://github.com/js-cookie/js-cookie)
|
|
326
|
-
- [
|
|
334
|
+
- [metalsmith/metalsmith](https://github.com/metalsmith/metalsmith)
|
|
327
335
|
- [mozilla/readability](https://github.com/mozilla/readability)
|
|
328
336
|
- [redis/node-redis](https://github.com/redis/node-redis)
|
|
337
|
+
- [saleor/saleor](https://github.com/saleor/saleor)
|
|
329
338
|
- [shipshapecode/shepherd](https://github.com/shipshapecode/shepherd)
|
|
339
|
+
- [StevenBlack/hosts](https://github.com/StevenBlack/hosts)
|
|
330
340
|
- [swagger-api/swagger-ui](https://github.com/swagger-api/swagger-ui) +
|
|
331
341
|
[swagger-editor](https://github.com/swagger-api/swagger-editor)
|
|
332
|
-
- [StevenBlack/hosts](https://github.com/StevenBlack/hosts)
|
|
333
342
|
- [tabler/tabler](https://github.com/tabler/tabler) + [tabler-icons](https://github.com/tabler/tabler-icons)
|
|
334
343
|
- [youzan/vant](https://github.com/youzan/vant)
|
|
335
344
|
- [Repositories that depend on release-it](https://github.com/release-it/release-it/network/dependents)
|
|
336
345
|
- GitHub search for [filename:.release-it.json](https://github.com/search?q=filename%3A.release-it.json)
|
|
337
346
|
|
|
338
|
-
##
|
|
347
|
+
## License
|
|
339
348
|
|
|
340
|
-
|
|
341
|
-
- [GitHub Help](https://docs.github.com) (→
|
|
342
|
-
[About Releases](https://docs.github.com/free-pro-team@latest/github/administering-a-repository/about-releases))
|
|
343
|
-
- [npm Blog: Publishing what you mean to publish](https://blog.npmjs.org/post/165769683050/publishing-what-you-mean-to-publish)
|
|
344
|
-
- [npm Documentation: package.json](https://docs.npmjs.com/cli/v6/configuring-npm/package-json)
|
|
345
|
-
- [Prereleases and npm](https://medium.com/@mbostock/prereleases-and-npm-e778fc5e2420)
|
|
346
|
-
- [Glob Primer (node-glob)](https://github.com/isaacs/node-glob#glob-primer) (release-it uses
|
|
347
|
-
[globby](https://github.com/sindresorhus/globby#readme))
|
|
349
|
+
[MIT](./LICENSE)
|
package/lib/plugin/GitRelease.js
CHANGED
|
@@ -10,7 +10,7 @@ class GitRelease extends GitBase {
|
|
|
10
10
|
getInitialOptions(options) {
|
|
11
11
|
const baseOptions = super.getInitialOptions(...arguments);
|
|
12
12
|
const git = options.git || defaultConfig.git;
|
|
13
|
-
const gitOptions = _.pick(git, ['tagName', 'pushRepo', 'changelog']);
|
|
13
|
+
const gitOptions = _.pick(git, ['tagName', 'tagMatch', 'pushRepo', 'changelog']);
|
|
14
14
|
return _.defaults(baseOptions, gitOptions);
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -7,6 +7,7 @@ const _ = require('lodash');
|
|
|
7
7
|
const retry = require('async-retry');
|
|
8
8
|
const newGithubReleaseUrl = require('new-github-release-url');
|
|
9
9
|
const open = require('open');
|
|
10
|
+
const ProxyAgent = require('proxy-agent');
|
|
10
11
|
const pkg = require('../../../package.json');
|
|
11
12
|
const { format, parseVersion, e } = require('../../util');
|
|
12
13
|
const Release = require('../GitRelease');
|
|
@@ -167,7 +168,7 @@ class GitHub extends Release {
|
|
|
167
168
|
};
|
|
168
169
|
|
|
169
170
|
if (proxy) {
|
|
170
|
-
options.
|
|
171
|
+
options.request.agent = new ProxyAgent(proxy);
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
const client = new Octokit(options);
|
|
@@ -4,6 +4,7 @@ const got = require('got');
|
|
|
4
4
|
const globby = require('globby');
|
|
5
5
|
const FormData = require('form-data');
|
|
6
6
|
const _ = require('lodash');
|
|
7
|
+
const allSettled = require('promise.allsettled');
|
|
7
8
|
const Release = require('../GitRelease');
|
|
8
9
|
const { format, e } = require('../../util');
|
|
9
10
|
const prompts = require('./prompts');
|
|
@@ -28,7 +29,7 @@ class GitLab extends Release {
|
|
|
28
29
|
const { tokenHeader } = this.options;
|
|
29
30
|
const { baseUrl } = this.getContext();
|
|
30
31
|
this._client = got.extend({
|
|
31
|
-
|
|
32
|
+
baseUrl,
|
|
32
33
|
method: 'POST',
|
|
33
34
|
headers: {
|
|
34
35
|
'user-agent': 'webpro/release-it',
|
|
@@ -127,7 +128,7 @@ class GitLab extends Release {
|
|
|
127
128
|
const requests = releaseMilestones.map(milestone => {
|
|
128
129
|
const options = {
|
|
129
130
|
method: 'GET',
|
|
130
|
-
|
|
131
|
+
query: {
|
|
131
132
|
title: milestone,
|
|
132
133
|
include_parent_milestones: true
|
|
133
134
|
}
|
|
@@ -148,7 +149,7 @@ class GitLab extends Release {
|
|
|
148
149
|
});
|
|
149
150
|
});
|
|
150
151
|
try {
|
|
151
|
-
await
|
|
152
|
+
await allSettled(requests).then(results => {
|
|
152
153
|
for (const result of results) {
|
|
153
154
|
if (result.status === 'rejected') {
|
|
154
155
|
throw e('Missing one or more milestones in GitLab. Creating a GitLab release will fail.', docs);
|
|
@@ -209,7 +210,8 @@ class GitLab extends Release {
|
|
|
209
210
|
|
|
210
211
|
const endpoint = `projects/${id}/releases`;
|
|
211
212
|
const options = {
|
|
212
|
-
json:
|
|
213
|
+
json: true,
|
|
214
|
+
body: {
|
|
213
215
|
name,
|
|
214
216
|
tag_name: tagName,
|
|
215
217
|
description
|
|
@@ -217,13 +219,13 @@ class GitLab extends Release {
|
|
|
217
219
|
};
|
|
218
220
|
|
|
219
221
|
if (this.assets.length) {
|
|
220
|
-
options.
|
|
222
|
+
options.body.assets = {
|
|
221
223
|
links: this.assets
|
|
222
224
|
};
|
|
223
225
|
}
|
|
224
226
|
|
|
225
227
|
if (releaseMilestones.length) {
|
|
226
|
-
options.
|
|
228
|
+
options.body.milestones = releaseMilestones;
|
|
227
229
|
}
|
|
228
230
|
|
|
229
231
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-it",
|
|
3
|
-
"version": "14.14.
|
|
3
|
+
"version": "14.14.3",
|
|
4
4
|
"description": "Generic CLI tool to automate versioning and package publishing related tasks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"form-data": "4.0.0",
|
|
66
66
|
"git-url-parse": "11.6.0",
|
|
67
67
|
"globby": "11.0.4",
|
|
68
|
-
"got": "
|
|
68
|
+
"got": "9.6.0",
|
|
69
69
|
"import-cwd": "3.0.0",
|
|
70
|
-
"inquirer": "8.2.
|
|
70
|
+
"inquirer": "8.2.0",
|
|
71
71
|
"is-ci": "3.0.1",
|
|
72
72
|
"lodash": "4.17.21",
|
|
73
73
|
"mime-types": "2.1.35",
|
|
@@ -76,6 +76,8 @@
|
|
|
76
76
|
"ora": "5.4.1",
|
|
77
77
|
"os-name": "4.0.1",
|
|
78
78
|
"parse-json": "5.2.0",
|
|
79
|
+
"promise.allsettled": "1.0.5",
|
|
80
|
+
"proxy-agent": "5.0.0",
|
|
79
81
|
"semver": "7.3.5",
|
|
80
82
|
"shelljs": "0.8.5",
|
|
81
83
|
"update-notifier": "5.1.0",
|
|
@@ -88,22 +90,25 @@
|
|
|
88
90
|
"devDependencies": {
|
|
89
91
|
"@octokit/request-error": "2.1.0",
|
|
90
92
|
"ava": "3.15.0",
|
|
91
|
-
"eslint": "
|
|
93
|
+
"eslint": "7.32.0",
|
|
92
94
|
"eslint-config-prettier": "8.5.0",
|
|
93
|
-
"eslint-plugin-ava": "
|
|
94
|
-
"eslint-plugin-import": "2.
|
|
95
|
+
"eslint-plugin-ava": "12.0.0",
|
|
96
|
+
"eslint-plugin-import": "2.26.0",
|
|
95
97
|
"eslint-plugin-prettier": "4.0.0",
|
|
96
98
|
"markdown-toc": "1.2.0",
|
|
97
|
-
"mock-fs": "
|
|
99
|
+
"mock-fs": "4.14.0",
|
|
98
100
|
"mock-stdio": "1.0.3",
|
|
99
101
|
"nock": "13.2.4",
|
|
100
102
|
"node-fetch": "2.6.7",
|
|
101
|
-
"prettier": "2.6.
|
|
103
|
+
"prettier": "2.6.2",
|
|
102
104
|
"proxyquire": "2.1.3",
|
|
103
105
|
"sinon": "13.0.1",
|
|
104
106
|
"strip-ansi": "6.0.0"
|
|
105
107
|
},
|
|
106
108
|
"engines": {
|
|
107
109
|
"node": ">=10"
|
|
110
|
+
},
|
|
111
|
+
"resolutions": {
|
|
112
|
+
"lru-cache": "6.0.0"
|
|
108
113
|
}
|
|
109
114
|
}
|
package/test/git.init.js
CHANGED
|
@@ -154,19 +154,13 @@ test.serial('should get the latest custom tag after fetch when tagName is config
|
|
|
154
154
|
test.serial('should get the latest tag based on tagMatch', async t => {
|
|
155
155
|
const shell = factory(Shell);
|
|
156
156
|
const gitClient = factory(Git, {
|
|
157
|
-
options: { git: { tagMatch: '[0-9][0-9]
|
|
157
|
+
options: { git: { tagMatch: '[0-9][0-9]\\.[0-1][0-9]\\.[0-9]*' } },
|
|
158
158
|
container: { shell }
|
|
159
159
|
});
|
|
160
|
-
const { bare, target } = t.context;
|
|
161
|
-
const other = mkTmpDir();
|
|
162
|
-
sh.exec('git push');
|
|
163
|
-
sh.exec(`git clone ${bare} ${other}`);
|
|
164
|
-
sh.pushd('-q', other);
|
|
165
160
|
sh.exec('git tag 1.0.0');
|
|
166
161
|
sh.exec('git tag 21.04.3');
|
|
167
162
|
sh.exec('git tag 1.0.1');
|
|
168
163
|
sh.exec('git push --tags');
|
|
169
|
-
sh.pushd('-q', target);
|
|
170
164
|
await gitClient.init();
|
|
171
165
|
t.is(gitClient.config.getContext('latestTag'), '21.04.3');
|
|
172
166
|
});
|
|
@@ -180,3 +174,21 @@ test.serial('should generate correct changelog', async t => {
|
|
|
180
174
|
const changelog = await gitClient.getChangelog();
|
|
181
175
|
t.regex(changelog, /\* Add file \(\w{7}\)\n\* Add file \(\w{7}\)/);
|
|
182
176
|
});
|
|
177
|
+
|
|
178
|
+
test.serial('should get the full changelog since latest major tag', async t => {
|
|
179
|
+
const shell = factory(Shell);
|
|
180
|
+
const gitClient = factory(Git, {
|
|
181
|
+
options: { git: { tagMatch: '[0-9]\\.[0-9]\\.[0-9]', changelog: git.changelog } },
|
|
182
|
+
container: { shell }
|
|
183
|
+
});
|
|
184
|
+
sh.exec('git tag 1.0.0');
|
|
185
|
+
gitAdd('line', 'file', 'Add file');
|
|
186
|
+
sh.exec('git tag 2.0.0-rc.0');
|
|
187
|
+
gitAdd('line', 'file', 'Add file');
|
|
188
|
+
sh.exec('git tag 2.0.0-rc.1');
|
|
189
|
+
gitAdd('line', 'file', 'Add file');
|
|
190
|
+
await gitClient.init();
|
|
191
|
+
t.is(gitClient.config.getContext('latestTag'), '1.0.0');
|
|
192
|
+
const changelog = await gitClient.getChangelog();
|
|
193
|
+
t.regex(changelog, /\* Add file \(\w{7}\)\n\* Add file \(\w{7}\)\n\* Add file \(\w{7}\)/);
|
|
194
|
+
});
|
package/test/github.js
CHANGED
|
@@ -236,6 +236,7 @@ test('should release to alternative host and proxy', async t => {
|
|
|
236
236
|
const { isReleased, releaseUrl } = github.getContext();
|
|
237
237
|
t.true(isReleased);
|
|
238
238
|
t.is(releaseUrl, `https://custom.example.org/user/repo/releases/tag/1.0.1`);
|
|
239
|
+
t.is(github.options.proxy, 'http://proxy:8080');
|
|
239
240
|
exec.restore();
|
|
240
241
|
});
|
|
241
242
|
|