release-it 15.1.0-next.0 → 15.1.2
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/git/Git.js +2 -1
- package/lib/plugin/github/GitHub.js +6 -4
- package/lib/plugin/gitlab/GitLab.js +3 -3
- package/package.json +16 -15
- package/test/git.js +14 -0
- package/test/github.js +3 -2
package/lib/plugin/git/Git.js
CHANGED
|
@@ -168,7 +168,8 @@ class Git extends GitBase {
|
|
|
168
168
|
|
|
169
169
|
commit({ message = this.options.commitMessage, args = this.options.commitArgs } = {}) {
|
|
170
170
|
const msg = format(message, this.config.getContext());
|
|
171
|
-
|
|
171
|
+
const commitMessageArgs = msg ? ['--message', msg] : [];
|
|
172
|
+
return this.exec(['git', 'commit', ...commitMessageArgs, ...fixArgs(args)]).then(
|
|
172
173
|
() => this.setContext({ isCommitted: true }),
|
|
173
174
|
err => {
|
|
174
175
|
this.debug(err);
|
|
@@ -2,6 +2,7 @@ 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';
|
|
5
6
|
import { globby } from 'globby';
|
|
6
7
|
import mime from 'mime-types';
|
|
7
8
|
import _ from 'lodash';
|
|
@@ -164,7 +165,8 @@ class GitHub extends Release {
|
|
|
164
165
|
userAgent: `release-it/${pkg.version}`,
|
|
165
166
|
log: this.config.isDebug ? console : null,
|
|
166
167
|
request: {
|
|
167
|
-
timeout
|
|
168
|
+
timeout,
|
|
169
|
+
fetch
|
|
168
170
|
}
|
|
169
171
|
};
|
|
170
172
|
|
|
@@ -280,14 +282,14 @@ class GitHub extends Release {
|
|
|
280
282
|
const context = this.config.getContext();
|
|
281
283
|
const { isDryRun } = this.config;
|
|
282
284
|
|
|
283
|
-
|
|
285
|
+
const patterns = _.castArray(assets).map(pattern => format(pattern, context));
|
|
286
|
+
|
|
287
|
+
this.log.exec('octokit repos.uploadReleaseAssets', patterns, { isDryRun });
|
|
284
288
|
|
|
285
289
|
if (!assets || !isReleased || isDryRun) {
|
|
286
290
|
return true;
|
|
287
291
|
}
|
|
288
292
|
|
|
289
|
-
const patterns = _.castArray(assets).map(pattern => format(pattern, context));
|
|
290
|
-
|
|
291
293
|
return globby(patterns).then(files => {
|
|
292
294
|
if (!files.length) {
|
|
293
295
|
this.log.warn(`octokit repos.uploadReleaseAssets: did not find "${assets}" relative to ${process.cwd()}`);
|
|
@@ -253,14 +253,14 @@ class GitLab extends Release {
|
|
|
253
253
|
const { isDryRun } = this.config;
|
|
254
254
|
const context = this.config.getContext();
|
|
255
255
|
|
|
256
|
-
|
|
256
|
+
const patterns = _.castArray(assets).map(pattern => format(pattern, context));
|
|
257
|
+
|
|
258
|
+
this.log.exec('gitlab releases#uploadAssets', patterns, { isDryRun });
|
|
257
259
|
|
|
258
260
|
if (!assets || isDryRun) {
|
|
259
261
|
return noop;
|
|
260
262
|
}
|
|
261
263
|
|
|
262
|
-
const patterns = _.castArray(assets).map(pattern => format(pattern, context));
|
|
263
|
-
|
|
264
264
|
return globby(patterns).then(files => {
|
|
265
265
|
if (!files.length) {
|
|
266
266
|
this.log.warn(`gitlab releases#uploadAssets: could not find "${assets}" relative to ${process.cwd()}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-it",
|
|
3
|
-
"version": "15.1.
|
|
3
|
+
"version": "15.1.2",
|
|
4
4
|
"description": "Generic CLI tool to automate versioning and package publishing related tasks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"type": "module",
|
|
39
39
|
"exports": {
|
|
40
40
|
".": "./lib/index.js",
|
|
41
|
-
"./test/util": "./test/util/index.js"
|
|
41
|
+
"./test/util.js": "./test/util/index.js"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|
|
44
44
|
"bin",
|
|
@@ -59,46 +59,47 @@
|
|
|
59
59
|
"license": "MIT",
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@iarna/toml": "2.2.5",
|
|
62
|
-
"@octokit/rest": "
|
|
62
|
+
"@octokit/rest": "19.0.3",
|
|
63
63
|
"async-retry": "1.3.3",
|
|
64
64
|
"chalk": "5.0.1",
|
|
65
65
|
"cosmiconfig": "7.0.1",
|
|
66
66
|
"execa": "6.1.0",
|
|
67
67
|
"form-data": "4.0.0",
|
|
68
68
|
"git-url-parse": "11.6.0",
|
|
69
|
-
"globby": "13.1.
|
|
70
|
-
"got": "12.0
|
|
71
|
-
"inquirer": "
|
|
69
|
+
"globby": "13.1.2",
|
|
70
|
+
"got": "12.1.0",
|
|
71
|
+
"inquirer": "9.0.1",
|
|
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.2.8",
|
|
76
77
|
"open": "8.4.0",
|
|
77
|
-
"ora": "6.1.
|
|
78
|
+
"ora": "6.1.2",
|
|
78
79
|
"os-name": "5.0.1",
|
|
79
80
|
"promise.allsettled": "1.0.5",
|
|
80
81
|
"proxy-agent": "5.0.0",
|
|
81
82
|
"semver": "7.3.7",
|
|
82
83
|
"shelljs": "0.8.5",
|
|
83
|
-
"update-notifier": "
|
|
84
|
+
"update-notifier": "6.0.2",
|
|
84
85
|
"url-join": "5.0.0",
|
|
85
86
|
"wildcard-match": "5.1.2",
|
|
86
87
|
"yargs-parser": "21.0.1"
|
|
87
88
|
},
|
|
88
89
|
"devDependencies": {
|
|
89
|
-
"@octokit/request-error": "
|
|
90
|
-
"ava": "4.
|
|
91
|
-
"eslint": "8.
|
|
90
|
+
"@octokit/request-error": "3.0.0",
|
|
91
|
+
"ava": "4.3.1",
|
|
92
|
+
"eslint": "8.19.0",
|
|
92
93
|
"eslint-config-prettier": "8.5.0",
|
|
93
94
|
"eslint-plugin-ava": "13.2.0",
|
|
94
95
|
"eslint-plugin-import": "2.26.0",
|
|
95
|
-
"eslint-plugin-prettier": "4.
|
|
96
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
96
97
|
"mock-fs": "5.1.2",
|
|
97
98
|
"mock-stdio": "1.0.3",
|
|
98
|
-
"nock": "13.2.
|
|
99
|
+
"nock": "13.2.8",
|
|
99
100
|
"nyc": "15.1.0",
|
|
100
|
-
"prettier": "2.
|
|
101
|
-
"sinon": "
|
|
101
|
+
"prettier": "2.7.1",
|
|
102
|
+
"sinon": "14.0.0",
|
|
102
103
|
"strip-ansi": "7.0.1"
|
|
103
104
|
},
|
|
104
105
|
"engines": {
|
package/test/git.js
CHANGED
|
@@ -140,6 +140,20 @@ test.serial('should commit, tag and push with extra args', async t => {
|
|
|
140
140
|
stub.restore();
|
|
141
141
|
});
|
|
142
142
|
|
|
143
|
+
test.serial('should amend commit without message if not provided', async t => {
|
|
144
|
+
const bare = mkTmpDir();
|
|
145
|
+
sh.exec(`git init --bare ${bare}`);
|
|
146
|
+
sh.exec(`git clone ${bare} .`);
|
|
147
|
+
gitAdd('line', 'file', 'Add file');
|
|
148
|
+
const options = { git: { commitArgs: ['--amend', '--no-edit', '--no-verify'] } };
|
|
149
|
+
const gitClient = factory(Git, { options });
|
|
150
|
+
const stub = sinon.stub(gitClient.shell, 'exec').resolves();
|
|
151
|
+
await gitClient.stage('package.json');
|
|
152
|
+
await gitClient.commit();
|
|
153
|
+
t.deepEqual(stub.secondCall.args[0], ['git', 'commit', '--amend', '--no-edit', '--no-verify']);
|
|
154
|
+
stub.restore();
|
|
155
|
+
});
|
|
156
|
+
|
|
143
157
|
test.serial('should commit and tag with quoted characters', async t => {
|
|
144
158
|
const bare = mkTmpDir();
|
|
145
159
|
sh.exec(`git init --bare ${bare}`);
|
package/test/github.js
CHANGED
|
@@ -198,7 +198,8 @@ test('should create new release for unreleased tag', async t => {
|
|
|
198
198
|
});
|
|
199
199
|
|
|
200
200
|
test('should release to enterprise host', async t => {
|
|
201
|
-
const
|
|
201
|
+
const options = { git, github: { tokenRef, pushRepo: 'git://github.example.org:user/repo' } };
|
|
202
|
+
const github = factory(GitHub, { options });
|
|
202
203
|
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
203
204
|
exec.withArgs('git remote get-url origin').resolves(`https://github.example.org/user/repo`);
|
|
204
205
|
exec.withArgs('git config --get remote.origin.url').resolves(`https://github.example.org/user/repo`);
|
|
@@ -307,7 +308,7 @@ test.serial('should skip authentication and collaborator checks when running on
|
|
|
307
308
|
|
|
308
309
|
t.is(authStub.callCount, 0);
|
|
309
310
|
t.is(collaboratorStub.callCount, 0);
|
|
310
|
-
t.is(github.getContext('username'),
|
|
311
|
+
t.is(github.getContext('username'), process.env.GITHUB_ACTOR);
|
|
311
312
|
|
|
312
313
|
authStub.restore();
|
|
313
314
|
collaboratorStub.restore();
|