release-it 17.6.0 → 18.0.0-next.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/github/GitHub.js +1 -3
- package/lib/plugin/gitlab/GitLab.js +24 -21
- package/lib/prompt.js +1 -1
- package/package.json +19 -21
- package/schema/git.json +5 -1
- package/test/gitlab.js +1 -6
- package/test/prompt.js +1 -1
|
@@ -2,7 +2,6 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import open from 'open';
|
|
4
4
|
import { Octokit } from '@octokit/rest';
|
|
5
|
-
import fetch from 'node-fetch';
|
|
6
5
|
import { globby } from 'globby';
|
|
7
6
|
import mime from 'mime-types';
|
|
8
7
|
import _ from 'lodash';
|
|
@@ -177,8 +176,7 @@ class GitHub extends Release {
|
|
|
177
176
|
userAgent: `release-it/${pkg.version}`,
|
|
178
177
|
log: this.config.isDebug ? console : null,
|
|
179
178
|
request: {
|
|
180
|
-
timeout
|
|
181
|
-
fetch
|
|
179
|
+
timeout
|
|
182
180
|
}
|
|
183
181
|
};
|
|
184
182
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import got from 'got';
|
|
4
3
|
import { globby } from 'globby';
|
|
5
|
-
import { FormData, fileFromSync } from 'node-fetch';
|
|
6
4
|
import _ from 'lodash';
|
|
7
5
|
import Release from '../GitRelease.js';
|
|
8
6
|
import { format, e } from '../../util.js';
|
|
@@ -30,22 +28,6 @@ class GitLab extends Release {
|
|
|
30
28
|
this.certificateAuthorityOption = _.isEmpty(https) ? {} : { https };
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
get client() {
|
|
34
|
-
if (this._client) return this._client;
|
|
35
|
-
const { tokenHeader } = this.options;
|
|
36
|
-
const { baseUrl } = this.getContext();
|
|
37
|
-
this._client = got.extend({
|
|
38
|
-
prefixUrl: baseUrl,
|
|
39
|
-
method: 'POST',
|
|
40
|
-
headers: {
|
|
41
|
-
'user-agent': 'webpro/release-it',
|
|
42
|
-
[tokenHeader]: this.token
|
|
43
|
-
},
|
|
44
|
-
...this.certificateAuthorityOption
|
|
45
|
-
});
|
|
46
|
-
return this._client;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
31
|
async init() {
|
|
50
32
|
await super.init();
|
|
51
33
|
|
|
@@ -179,8 +161,28 @@ class GitLab extends Release {
|
|
|
179
161
|
const { baseUrl } = this.getContext();
|
|
180
162
|
this.debug(Object.assign({ url: `${baseUrl}/${endpoint}` }, options));
|
|
181
163
|
const method = (options.method || 'POST').toLowerCase();
|
|
182
|
-
const
|
|
183
|
-
const
|
|
164
|
+
const { tokenHeader } = this.options;
|
|
165
|
+
const url = `${baseUrl}/${endpoint}${options.searchParams ? `?${new URLSearchParams(options.searchParams)}` : ''}`;
|
|
166
|
+
const headers = {
|
|
167
|
+
'user-agent': 'webpro/release-it',
|
|
168
|
+
[tokenHeader]: this.token
|
|
169
|
+
};
|
|
170
|
+
const requestOptions = {
|
|
171
|
+
method,
|
|
172
|
+
headers,
|
|
173
|
+
...this.certificateAuthorityOption
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const response = await fetch(
|
|
177
|
+
url,
|
|
178
|
+
options.json || options.body
|
|
179
|
+
? {
|
|
180
|
+
...requestOptions,
|
|
181
|
+
body: options.json ? JSON.stringify(options.json) : options.body
|
|
182
|
+
}
|
|
183
|
+
: requestOptions
|
|
184
|
+
);
|
|
185
|
+
const body = await response.json();
|
|
184
186
|
this.debug(body);
|
|
185
187
|
return body;
|
|
186
188
|
}
|
|
@@ -239,7 +241,8 @@ class GitLab extends Release {
|
|
|
239
241
|
const endpoint = `projects/${id}/uploads`;
|
|
240
242
|
|
|
241
243
|
const body = new FormData();
|
|
242
|
-
|
|
244
|
+
const rawData = await fs.promises.readFile(filePath);
|
|
245
|
+
body.set('file', new Blob([rawData]), name);
|
|
243
246
|
const options = { body };
|
|
244
247
|
|
|
245
248
|
try {
|
package/lib/prompt.js
CHANGED
|
@@ -19,7 +19,7 @@ class Prompt {
|
|
|
19
19
|
name: promptName,
|
|
20
20
|
message: prompt.message(context),
|
|
21
21
|
choices: 'choices' in prompt && prompt.choices(context),
|
|
22
|
-
transformer: 'transformer' in prompt
|
|
22
|
+
transformer: 'transformer' in prompt ? prompt.transformer(context) : undefined
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
const answers = await this.createPrompt([options]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-it",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0-next.0",
|
|
4
4
|
"description": "Generic CLI tool to automate versioning and package publishing-related tasks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build",
|
|
@@ -79,28 +79,26 @@
|
|
|
79
79
|
"license": "MIT",
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@iarna/toml": "2.2.5",
|
|
82
|
-
"@octokit/rest": "
|
|
82
|
+
"@octokit/rest": "21.0.2",
|
|
83
83
|
"async-retry": "1.3.3",
|
|
84
84
|
"chalk": "5.3.0",
|
|
85
85
|
"cosmiconfig": "9.0.0",
|
|
86
|
-
"execa": "
|
|
87
|
-
"git-url-parse": "
|
|
86
|
+
"execa": "9.3.1",
|
|
87
|
+
"git-url-parse": "15.0.0",
|
|
88
88
|
"globby": "14.0.2",
|
|
89
|
-
"
|
|
90
|
-
"inquirer": "9.3.2",
|
|
89
|
+
"inquirer": "10.1.8",
|
|
91
90
|
"is-ci": "3.0.1",
|
|
92
91
|
"issue-parser": "7.0.1",
|
|
93
92
|
"lodash": "4.17.21",
|
|
94
93
|
"mime-types": "2.1.35",
|
|
95
94
|
"new-github-release-url": "2.0.0",
|
|
96
|
-
"node-fetch": "3.3.2",
|
|
97
95
|
"open": "10.1.0",
|
|
98
96
|
"ora": "8.0.1",
|
|
99
|
-
"os-name": "
|
|
97
|
+
"os-name": "6.0.0",
|
|
100
98
|
"proxy-agent": "6.4.0",
|
|
101
|
-
"semver": "7.6.
|
|
99
|
+
"semver": "7.6.3",
|
|
102
100
|
"shelljs": "0.8.5",
|
|
103
|
-
"update-notifier": "7.
|
|
101
|
+
"update-notifier": "7.2.0",
|
|
104
102
|
"url-join": "5.0.0",
|
|
105
103
|
"wildcard-match": "5.1.3",
|
|
106
104
|
"yargs-parser": "21.1.1"
|
|
@@ -108,35 +106,35 @@
|
|
|
108
106
|
"devDependencies": {
|
|
109
107
|
"@eslint/compat": "1.1.1",
|
|
110
108
|
"@eslint/eslintrc": "3.1.0",
|
|
111
|
-
"@eslint/js": "9.
|
|
112
|
-
"@octokit/request-error": "
|
|
109
|
+
"@eslint/js": "9.9.1",
|
|
110
|
+
"@octokit/request-error": "6.1.4",
|
|
113
111
|
"@types/node": "20.14.10",
|
|
114
112
|
"ava": "6.1.3",
|
|
115
|
-
"eslint": "9.
|
|
113
|
+
"eslint": "9.9.1",
|
|
116
114
|
"eslint-config-prettier": "9.1.0",
|
|
117
115
|
"eslint-plugin-ava": "15.0.1",
|
|
118
|
-
"eslint-plugin-import-x": "3.0
|
|
119
|
-
"eslint-plugin-prettier": "5.1
|
|
116
|
+
"eslint-plugin-import-x": "3.1.0",
|
|
117
|
+
"eslint-plugin-prettier": "5.2.1",
|
|
120
118
|
"fs-monkey": "1.0.6",
|
|
121
|
-
"globals": "15.
|
|
119
|
+
"globals": "15.9.0",
|
|
122
120
|
"installed-check": "9.3.0",
|
|
123
|
-
"knip": "5.
|
|
124
|
-
"memfs": "4.
|
|
121
|
+
"knip": "5.27.3",
|
|
122
|
+
"memfs": "4.11.1",
|
|
125
123
|
"mock-stdio": "1.0.3",
|
|
126
|
-
"nock": "
|
|
124
|
+
"nock": "14.0.0-beta.8",
|
|
127
125
|
"prettier": "3.3.3",
|
|
128
126
|
"remark-cli": "12.0.1",
|
|
129
127
|
"remark-preset-webpro": "1.1.0",
|
|
130
128
|
"sinon": "18.0.0",
|
|
131
129
|
"strip-ansi": "7.1.0",
|
|
132
|
-
"typescript": "5.5.
|
|
130
|
+
"typescript": "5.5.4"
|
|
133
131
|
},
|
|
134
132
|
"overrides": {
|
|
135
133
|
"pac-resolver": "7.0.1",
|
|
136
134
|
"socks": "2.8.3"
|
|
137
135
|
},
|
|
138
136
|
"engines": {
|
|
139
|
-
"node": "^
|
|
137
|
+
"node": "^20.9.0 || ^22.0.0"
|
|
140
138
|
},
|
|
141
139
|
"remarkConfig": {
|
|
142
140
|
"plugins": [
|
package/schema/git.json
CHANGED
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
"default": true
|
|
15
15
|
},
|
|
16
16
|
"requireBranch": {
|
|
17
|
-
"
|
|
17
|
+
"oneOf": [
|
|
18
|
+
{ "type": "boolean", "enum": [false] },
|
|
19
|
+
{ "type": "string" },
|
|
20
|
+
{ "type": "array", "items": { "type": "string" } }
|
|
21
|
+
],
|
|
18
22
|
"default": false
|
|
19
23
|
},
|
|
20
24
|
"requireUpstream": {
|
package/test/gitlab.js
CHANGED
|
@@ -226,29 +226,24 @@ test('should not make requests in dry run', async t => {
|
|
|
226
226
|
const options = { 'dry-run': true, git: { pushRepo }, gitlab: { releaseName: 'R', tokenRef } };
|
|
227
227
|
const gitlab = factory(GitLab, { options });
|
|
228
228
|
sinon.stub(gitlab, 'getLatestVersion').resolves('1.0.0');
|
|
229
|
-
const spy = sinon.spy(gitlab, 'client', ['get']);
|
|
230
229
|
|
|
231
230
|
await runTasks(gitlab);
|
|
232
231
|
|
|
233
232
|
const { isReleased, releaseUrl } = gitlab.getContext();
|
|
234
|
-
|
|
233
|
+
|
|
235
234
|
t.is(gitlab.log.exec.args[2][0], 'gitlab releases#uploadAssets');
|
|
236
235
|
t.is(gitlab.log.exec.args[3][0], 'gitlab releases#createRelease "R" (1.0.1)');
|
|
237
236
|
t.true(isReleased);
|
|
238
237
|
t.is(releaseUrl, `${pushRepo}/-/releases`);
|
|
239
|
-
spy.get.restore();
|
|
240
238
|
});
|
|
241
239
|
|
|
242
240
|
test('should skip checks', async t => {
|
|
243
241
|
const options = { gitlab: { tokenRef, skipChecks: true, release: true, milestones: ['v1.0.0'] } };
|
|
244
242
|
const gitlab = factory(GitLab, { options });
|
|
245
|
-
const spy = sinon.spy(gitlab, 'client', ['get']);
|
|
246
243
|
|
|
247
244
|
await t.notThrowsAsync(gitlab.init());
|
|
248
245
|
await t.notThrowsAsync(gitlab.beforeRelease());
|
|
249
246
|
|
|
250
|
-
t.is(spy.get.callCount, 0);
|
|
251
|
-
|
|
252
247
|
t.is(gitlab.log.exec.args.filter(entry => /checkReleaseMilestones/.test(entry[0])).length, 0);
|
|
253
248
|
});
|
|
254
249
|
|