release-it 15.8.0 → 15.9.1
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 +4 -1
- package/lib/plugin/GitRelease.js +10 -1
- package/package.json +11 -11
- package/test/github.js +29 -0
package/README.md
CHANGED
|
@@ -347,8 +347,11 @@ While mostly used as a CLI tool, release-it can be used as a dependency to integ
|
|
|
347
347
|
- [js-cookie/js-cookie](https://github.com/js-cookie/js-cookie)
|
|
348
348
|
- [metalsmith/metalsmith](https://github.com/metalsmith/metalsmith)
|
|
349
349
|
- [mozilla/readability](https://github.com/mozilla/readability)
|
|
350
|
+
- [pahen/madge](https://github.com/pahen/madge)
|
|
350
351
|
- [redis/node-redis](https://github.com/redis/node-redis)
|
|
352
|
+
- [reduxjs/redux](https://github.com/reduxjs/redux)
|
|
351
353
|
- [saleor/saleor](https://github.com/saleor/saleor)
|
|
354
|
+
- [Semantic-Org/Semantic-UI-React](https://github.com/Semantic-Org/Semantic-UI-React)
|
|
352
355
|
- [shipshapecode/shepherd](https://github.com/shipshapecode/shepherd)
|
|
353
356
|
- [StevenBlack/hosts](https://github.com/StevenBlack/hosts)
|
|
354
357
|
- [swagger-api/swagger-ui](https://github.com/swagger-api/swagger-ui) +
|
|
@@ -356,7 +359,7 @@ While mostly used as a CLI tool, release-it can be used as a dependency to integ
|
|
|
356
359
|
- [tabler/tabler](https://github.com/tabler/tabler) + [tabler-icons](https://github.com/tabler/tabler-icons)
|
|
357
360
|
- [youzan/vant](https://github.com/youzan/vant)
|
|
358
361
|
- [Repositories that depend on release-it](https://github.com/release-it/release-it/network/dependents)
|
|
359
|
-
- GitHub search for [
|
|
362
|
+
- GitHub search for [path:\*\*/.release-it.json](https://github.com/search?q=path%3A**%2F.release-it.json&type=code)
|
|
360
363
|
|
|
361
364
|
## License
|
|
362
365
|
|
package/lib/plugin/GitRelease.js
CHANGED
|
@@ -24,13 +24,22 @@ class GitRelease extends GitBase {
|
|
|
24
24
|
async beforeRelease() {
|
|
25
25
|
const { releaseNotes: script } = this.options;
|
|
26
26
|
const { changelog } = this.config.getContext();
|
|
27
|
-
const releaseNotes = script ? await this.
|
|
27
|
+
const releaseNotes = script ? await this.processReleaseNotes(script) : changelog;
|
|
28
28
|
this.setContext({ releaseNotes });
|
|
29
29
|
if (releaseNotes !== changelog) {
|
|
30
30
|
this.log.preview({ title: 'release notes', text: releaseNotes });
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
async processReleaseNotes(script) {
|
|
35
|
+
if (typeof script === 'function') {
|
|
36
|
+
const ctx = Object.assign({}, this.config.getContext(), { [this.namespace]: this.getContext() });
|
|
37
|
+
return script(ctx);
|
|
38
|
+
} else {
|
|
39
|
+
return this.exec(script);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
34
43
|
afterRelease() {
|
|
35
44
|
const { isReleased, releaseUrl } = this.getContext();
|
|
36
45
|
if (isReleased) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-it",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.9.1",
|
|
4
4
|
"description": "Generic CLI tool to automate versioning and package publishing related tasks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build",
|
|
@@ -63,19 +63,19 @@
|
|
|
63
63
|
"@octokit/rest": "19.0.7",
|
|
64
64
|
"async-retry": "1.3.3",
|
|
65
65
|
"chalk": "5.2.0",
|
|
66
|
-
"cosmiconfig": "8.1.
|
|
67
|
-
"execa": "7.
|
|
66
|
+
"cosmiconfig": "8.1.3",
|
|
67
|
+
"execa": "7.1.1",
|
|
68
68
|
"git-url-parse": "13.1.0",
|
|
69
69
|
"globby": "13.1.3",
|
|
70
70
|
"got": "12.6.0",
|
|
71
|
-
"inquirer": "9.1.
|
|
71
|
+
"inquirer": "9.1.5",
|
|
72
72
|
"is-ci": "3.0.1",
|
|
73
73
|
"lodash": "4.17.21",
|
|
74
74
|
"mime-types": "2.1.35",
|
|
75
75
|
"new-github-release-url": "2.0.0",
|
|
76
|
-
"node-fetch": "3.3.
|
|
77
|
-
"open": "
|
|
78
|
-
"ora": "6.
|
|
76
|
+
"node-fetch": "3.3.1",
|
|
77
|
+
"open": "9.0.0",
|
|
78
|
+
"ora": "6.2.0",
|
|
79
79
|
"os-name": "5.1.0",
|
|
80
80
|
"promise.allsettled": "1.0.6",
|
|
81
81
|
"proxy-agent": "5.0.0",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@octokit/request-error": "3.0.3",
|
|
91
91
|
"ava": "5.2.0",
|
|
92
|
-
"eslint": "8.
|
|
93
|
-
"eslint-config-prettier": "8.
|
|
92
|
+
"eslint": "8.36.0",
|
|
93
|
+
"eslint-config-prettier": "8.8.0",
|
|
94
94
|
"eslint-plugin-ava": "14.0.0",
|
|
95
95
|
"eslint-plugin-import": "2.27.5",
|
|
96
96
|
"eslint-plugin-prettier": "4.2.1",
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"mock-stdio": "1.0.3",
|
|
99
99
|
"nock": "13.3.0",
|
|
100
100
|
"nyc": "15.1.0",
|
|
101
|
-
"prettier": "2.8.
|
|
102
|
-
"sinon": "15.0.
|
|
101
|
+
"prettier": "2.8.6",
|
|
102
|
+
"sinon": "15.0.2",
|
|
103
103
|
"strip-ansi": "7.0.1"
|
|
104
104
|
},
|
|
105
105
|
"engines": {
|
package/test/github.js
CHANGED
|
@@ -164,6 +164,35 @@ test('should update release and upload assets', async t => {
|
|
|
164
164
|
exec.restore();
|
|
165
165
|
});
|
|
166
166
|
|
|
167
|
+
test('should create custom release notes using releaseNotes function', async t => {
|
|
168
|
+
const options = {
|
|
169
|
+
git,
|
|
170
|
+
github: {
|
|
171
|
+
pushRepo,
|
|
172
|
+
tokenRef,
|
|
173
|
+
release: true,
|
|
174
|
+
releaseName: 'Release ${tagName}',
|
|
175
|
+
releaseNotes(context) {
|
|
176
|
+
return `Custom notes for tag ${context.tagName}`;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const github = factory(GitHub, { options });
|
|
181
|
+
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
182
|
+
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('2.0.1');
|
|
183
|
+
|
|
184
|
+
interceptAuthentication();
|
|
185
|
+
interceptCollaborator();
|
|
186
|
+
interceptCreate({ body: { tag_name: '2.0.2', name: 'Release 2.0.2', body: 'Custom notes for tag 2.0.2' } });
|
|
187
|
+
|
|
188
|
+
await runTasks(github);
|
|
189
|
+
|
|
190
|
+
const { isReleased, releaseUrl } = github.getContext();
|
|
191
|
+
t.true(isReleased);
|
|
192
|
+
t.is(releaseUrl, 'https://github.com/user/repo/releases/tag/2.0.2');
|
|
193
|
+
exec.restore();
|
|
194
|
+
});
|
|
195
|
+
|
|
167
196
|
test('should create new release for unreleased tag', async t => {
|
|
168
197
|
const options = {
|
|
169
198
|
increment: false,
|