release-it 17.7.0 → 17.8.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.
- package/lib/plugin/GitRelease.js +4 -1
- package/lib/plugin/github/GitHub.js +25 -5
- package/package.json +16 -16
- package/schema/github.json +4 -0
- package/test/github.js +37 -0
- package/test/stub/github.js +26 -5
- package/types/config.d.ts +3 -0
package/lib/plugin/GitRelease.js
CHANGED
|
@@ -48,10 +48,13 @@ class GitRelease extends GitBase {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
afterRelease() {
|
|
51
|
-
const { isReleased, releaseUrl } = this.getContext();
|
|
51
|
+
const { isReleased, releaseUrl, discussionUrl } = this.getContext();
|
|
52
52
|
if (isReleased) {
|
|
53
53
|
this.log.log(`🔗 ${releaseUrl}`);
|
|
54
54
|
}
|
|
55
|
+
if (discussionUrl) {
|
|
56
|
+
this.log.log(`🔗 ${discussionUrl}`);
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
|
|
@@ -209,7 +209,14 @@ class GitHub extends Release {
|
|
|
209
209
|
|
|
210
210
|
getOctokitReleaseOptions(options = {}) {
|
|
211
211
|
const { owner, project: repo } = this.getContext('repo');
|
|
212
|
-
const {
|
|
212
|
+
const {
|
|
213
|
+
releaseName,
|
|
214
|
+
draft = false,
|
|
215
|
+
preRelease = false,
|
|
216
|
+
autoGenerate = false,
|
|
217
|
+
makeLatest = true,
|
|
218
|
+
discussionCategoryName = false
|
|
219
|
+
} = this.options;
|
|
213
220
|
const { tagName } = this.config.getContext();
|
|
214
221
|
const { version, releaseNotes, isUpdate } = this.getContext();
|
|
215
222
|
const { isPreRelease } = parseVersion(version);
|
|
@@ -228,7 +235,8 @@ class GitHub extends Release {
|
|
|
228
235
|
body,
|
|
229
236
|
draft,
|
|
230
237
|
prerelease: isPreRelease || preRelease,
|
|
231
|
-
generate_release_notes: autoGenerate
|
|
238
|
+
generate_release_notes: autoGenerate,
|
|
239
|
+
discussion_category_name: discussionCategoryName
|
|
232
240
|
};
|
|
233
241
|
return Object.assign(options, contextOptions);
|
|
234
242
|
}
|
|
@@ -257,9 +265,21 @@ class GitHub extends Release {
|
|
|
257
265
|
this.debug(options);
|
|
258
266
|
const response = await this.client.repos.createRelease(options);
|
|
259
267
|
this.debug(response.data);
|
|
260
|
-
const { html_url, upload_url, id } = response.data;
|
|
261
|
-
this.setContext({
|
|
262
|
-
|
|
268
|
+
const { html_url, upload_url, id, discussion_url } = response.data;
|
|
269
|
+
this.setContext({
|
|
270
|
+
isReleased: true,
|
|
271
|
+
releaseId: id,
|
|
272
|
+
releaseUrl: html_url,
|
|
273
|
+
upload_url,
|
|
274
|
+
discussionUrl: discussion_url
|
|
275
|
+
});
|
|
276
|
+
this.config.setContext({
|
|
277
|
+
isReleased: true,
|
|
278
|
+
releaseId: id,
|
|
279
|
+
releaseUrl: html_url,
|
|
280
|
+
upload_url,
|
|
281
|
+
discussionUrl: discussion_url
|
|
282
|
+
});
|
|
263
283
|
this.log.verbose(`octokit repos.createRelease: done (${response.headers.location})`);
|
|
264
284
|
return response.data;
|
|
265
285
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-it",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.8.0",
|
|
4
4
|
"description": "Generic CLI tool to automate versioning and package publishing-related tasks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"chalk": "5.3.0",
|
|
85
85
|
"ci-info": "^4.0.0",
|
|
86
86
|
"cosmiconfig": "9.0.0",
|
|
87
|
-
"execa": "8.0.
|
|
87
|
+
"execa": "8.0.0",
|
|
88
88
|
"git-url-parse": "14.0.0",
|
|
89
89
|
"globby": "14.0.2",
|
|
90
90
|
"inquirer": "9.3.2",
|
|
@@ -93,41 +93,41 @@
|
|
|
93
93
|
"mime-types": "2.1.35",
|
|
94
94
|
"new-github-release-url": "2.0.0",
|
|
95
95
|
"open": "10.1.0",
|
|
96
|
-
"ora": "8.0
|
|
96
|
+
"ora": "8.1.0",
|
|
97
97
|
"os-name": "5.1.0",
|
|
98
98
|
"proxy-agent": "6.4.0",
|
|
99
|
-
"semver": "7.6.
|
|
99
|
+
"semver": "7.6.3",
|
|
100
100
|
"shelljs": "0.8.5",
|
|
101
|
-
"update-notifier": "7.1
|
|
101
|
+
"update-notifier": "7.3.1",
|
|
102
102
|
"url-join": "5.0.0",
|
|
103
103
|
"wildcard-match": "5.1.3",
|
|
104
104
|
"yargs-parser": "21.1.1"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
|
-
"@eslint/compat": "1.
|
|
107
|
+
"@eslint/compat": "1.2.0",
|
|
108
108
|
"@eslint/eslintrc": "3.1.0",
|
|
109
|
-
"@eslint/js": "9.
|
|
109
|
+
"@eslint/js": "9.12.0",
|
|
110
110
|
"@octokit/request-error": "5.1.0",
|
|
111
111
|
"@types/node": "20.14.10",
|
|
112
112
|
"ava": "6.1.3",
|
|
113
|
-
"eslint": "9.
|
|
113
|
+
"eslint": "9.12.0",
|
|
114
114
|
"eslint-config-prettier": "9.1.0",
|
|
115
115
|
"eslint-plugin-ava": "15.0.1",
|
|
116
|
-
"eslint-plugin-import-x": "3.
|
|
117
|
-
"eslint-plugin-prettier": "5.1
|
|
116
|
+
"eslint-plugin-import-x": "4.3.1",
|
|
117
|
+
"eslint-plugin-prettier": "5.2.1",
|
|
118
118
|
"fs-monkey": "1.0.6",
|
|
119
|
-
"globals": "15.
|
|
119
|
+
"globals": "15.10.0",
|
|
120
120
|
"installed-check": "9.3.0",
|
|
121
|
-
"knip": "5.
|
|
122
|
-
"memfs": "4.
|
|
121
|
+
"knip": "5.31.0",
|
|
122
|
+
"memfs": "4.12.0",
|
|
123
123
|
"mock-stdio": "1.0.3",
|
|
124
124
|
"nock": "14.0.0-beta.8",
|
|
125
125
|
"prettier": "3.3.3",
|
|
126
126
|
"remark-cli": "12.0.1",
|
|
127
|
-
"remark-preset-webpro": "1.1.
|
|
128
|
-
"sinon": "
|
|
127
|
+
"remark-preset-webpro": "1.1.1",
|
|
128
|
+
"sinon": "19.0.2",
|
|
129
129
|
"strip-ansi": "7.1.0",
|
|
130
|
-
"typescript": "5.
|
|
130
|
+
"typescript": "5.6.2"
|
|
131
131
|
},
|
|
132
132
|
"overrides": {
|
|
133
133
|
"pac-resolver": "7.0.1",
|
package/schema/github.json
CHANGED
package/test/github.js
CHANGED
|
@@ -508,3 +508,40 @@ test('should generate search queries correctly', t => {
|
|
|
508
508
|
'Each query should not exceed 256 characters after encoding'
|
|
509
509
|
);
|
|
510
510
|
});
|
|
511
|
+
|
|
512
|
+
test('should create auto-generated discussion', async t => {
|
|
513
|
+
const options = {
|
|
514
|
+
git,
|
|
515
|
+
github: {
|
|
516
|
+
pushRepo,
|
|
517
|
+
tokenRef,
|
|
518
|
+
release: true,
|
|
519
|
+
releaseName: 'Release ${tagName}',
|
|
520
|
+
autoGenerate: false,
|
|
521
|
+
discussionCategoryName: 'Announcement'
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
const github = factory(GitHub, { options });
|
|
525
|
+
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
526
|
+
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('2.0.1');
|
|
527
|
+
|
|
528
|
+
interceptAuthentication();
|
|
529
|
+
interceptCollaborator();
|
|
530
|
+
interceptCreate({
|
|
531
|
+
body: {
|
|
532
|
+
tag_name: '2.0.2',
|
|
533
|
+
name: 'Release 2.0.2',
|
|
534
|
+
generate_release_notes: false,
|
|
535
|
+
body: null,
|
|
536
|
+
discussion_category_name: 'Announcement'
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
await runTasks(github);
|
|
541
|
+
|
|
542
|
+
const { isReleased, releaseUrl, discussionUrl } = github.getContext();
|
|
543
|
+
t.true(isReleased);
|
|
544
|
+
t.is(releaseUrl, 'https://github.com/user/repo/releases/tag/2.0.2');
|
|
545
|
+
t.is(discussionUrl, 'https://github.com/user/repo/discussions/1');
|
|
546
|
+
exec.restore();
|
|
547
|
+
});
|
package/test/stub/github.js
CHANGED
|
@@ -44,7 +44,16 @@ const interceptCreate = ({
|
|
|
44
44
|
host = 'github.com',
|
|
45
45
|
owner = 'user',
|
|
46
46
|
project = 'repo',
|
|
47
|
-
body: {
|
|
47
|
+
body: {
|
|
48
|
+
tag_name,
|
|
49
|
+
name = '',
|
|
50
|
+
body = null,
|
|
51
|
+
prerelease = false,
|
|
52
|
+
draft = false,
|
|
53
|
+
generate_release_notes = false,
|
|
54
|
+
make_latest = 'true',
|
|
55
|
+
discussion_category_name = false
|
|
56
|
+
}
|
|
48
57
|
} = {}) => {
|
|
49
58
|
nock(api)
|
|
50
59
|
.post(`/repos/${owner}/${project}/releases`, {
|
|
@@ -54,7 +63,8 @@ const interceptCreate = ({
|
|
|
54
63
|
prerelease,
|
|
55
64
|
draft,
|
|
56
65
|
generate_release_notes,
|
|
57
|
-
make_latest
|
|
66
|
+
make_latest,
|
|
67
|
+
discussion_category_name
|
|
58
68
|
})
|
|
59
69
|
.reply(() => {
|
|
60
70
|
const id = 1;
|
|
@@ -67,7 +77,8 @@ const interceptCreate = ({
|
|
|
67
77
|
draft,
|
|
68
78
|
generate_release_notes,
|
|
69
79
|
upload_url: `https://uploads.${host}/repos/${owner}/${project}/releases/${id}/assets{?name,label}`,
|
|
70
|
-
html_url: `https://${host}/${owner}/${project}/releases/tag/${tag_name}
|
|
80
|
+
html_url: `https://${host}/${owner}/${project}/releases/tag/${tag_name}`,
|
|
81
|
+
discussion_url: discussion_category_name ? `https://${host}/${owner}/${project}/discussions/${id}` : undefined
|
|
71
82
|
};
|
|
72
83
|
return [200, responseBody, { location: `${api}/repos/${owner}/${project}/releases/${id}` }];
|
|
73
84
|
});
|
|
@@ -78,7 +89,16 @@ const interceptUpdate = ({
|
|
|
78
89
|
api = 'https://api.github.com',
|
|
79
90
|
owner = 'user',
|
|
80
91
|
project = 'repo',
|
|
81
|
-
body: {
|
|
92
|
+
body: {
|
|
93
|
+
tag_name,
|
|
94
|
+
name = '',
|
|
95
|
+
body = null,
|
|
96
|
+
prerelease = false,
|
|
97
|
+
draft = false,
|
|
98
|
+
generate_release_notes = false,
|
|
99
|
+
make_latest = 'true',
|
|
100
|
+
discussion_category_name = false
|
|
101
|
+
}
|
|
82
102
|
} = {}) => {
|
|
83
103
|
nock(api)
|
|
84
104
|
.patch(`/repos/${owner}/${project}/releases/1`, {
|
|
@@ -88,7 +108,8 @@ const interceptUpdate = ({
|
|
|
88
108
|
draft,
|
|
89
109
|
prerelease,
|
|
90
110
|
generate_release_notes,
|
|
91
|
-
make_latest
|
|
111
|
+
make_latest,
|
|
112
|
+
discussion_category_name
|
|
92
113
|
})
|
|
93
114
|
.reply(200, {
|
|
94
115
|
id: 1,
|