release-it 14.11.8 → 15.0.0-esm.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/bin/release-it.js +6 -4
- package/lib/cli.js +18 -4
- package/lib/config.js +12 -14
- package/lib/deprecated.js +6 -4
- package/lib/index.js +139 -13
- package/lib/log.js +6 -4
- package/lib/metrics.js +11 -8
- package/lib/plugin/GitBase.js +4 -4
- package/lib/plugin/GitRelease.js +6 -4
- package/lib/plugin/Plugin.js +3 -3
- package/lib/plugin/factory.js +26 -14
- package/lib/plugin/git/Git.js +7 -7
- package/lib/plugin/git/prompts.js +2 -2
- package/lib/plugin/github/GitHub.js +20 -15
- package/lib/plugin/github/prompts.js +2 -2
- package/lib/plugin/gitlab/GitLab.js +10 -10
- package/lib/plugin/gitlab/prompts.js +2 -2
- package/lib/plugin/npm/npm.js +8 -8
- package/lib/plugin/npm/prompts.js +1 -1
- package/lib/plugin/version/Version.js +4 -4
- package/lib/prompt.js +2 -2
- package/lib/shell.js +7 -5
- package/lib/spinner.js +5 -5
- package/lib/util.js +13 -9
- package/package.json +19 -17
- package/test/cli.js +6 -4
- package/test/config.js +7 -5
- package/test/deprecated.js +4 -4
- package/test/git.init.js +9 -7
- package/test/git.js +7 -7
- package/test/github.js +57 -15
- package/test/gitlab.js +7 -7
- package/test/log.js +5 -5
- package/test/metrics.js +3 -3
- package/test/npm.js +7 -9
- package/test/plugins.js +92 -117
- package/test/prompt.js +9 -9
- package/test/shell.js +6 -6
- package/test/spinner.js +11 -13
- package/test/stub/github.js +2 -2
- package/test/stub/gitlab.js +7 -9
- package/test/stub/plugin-context.js +36 -0
- package/test/stub/plugin-replace.js +9 -0
- package/test/stub/plugin.js +39 -0
- package/test/stub/shell.js +5 -3
- package/test/tasks.interactive.js +14 -14
- package/test/tasks.js +35 -34
- package/test/util/helpers.js +5 -10
- package/test/util/index.js +12 -12
- package/test/util/setup.js +2 -14
- package/test/utils.js +5 -5
- package/test/version.js +4 -4
- package/lib/tasks.js +0 -139
package/lib/shell.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import sh from 'shelljs';
|
|
2
|
+
import { execa } from 'execa';
|
|
3
|
+
import _debug from 'debug';
|
|
4
|
+
import { format } from './util.js';
|
|
5
|
+
|
|
6
|
+
const debug = _debug('release-it:shell');
|
|
5
7
|
|
|
6
8
|
sh.config.silent = !debug.enabled;
|
|
7
9
|
|
|
@@ -86,4 +88,4 @@ class Shell {
|
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
|
|
89
|
-
|
|
91
|
+
export default Shell;
|
package/lib/spinner.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { oraPromise } from 'ora';
|
|
2
|
+
import { format } from './util.js';
|
|
3
3
|
|
|
4
4
|
const noop = Promise.resolve();
|
|
5
5
|
|
|
6
6
|
class Spinner {
|
|
7
7
|
constructor({ container = {} } = {}) {
|
|
8
8
|
this.config = container.config;
|
|
9
|
-
this.ora = container.ora ||
|
|
9
|
+
this.ora = container.ora || oraPromise;
|
|
10
10
|
}
|
|
11
11
|
show({ enabled = true, task, label, external = false, context }) {
|
|
12
12
|
if (!enabled) return noop;
|
|
@@ -19,11 +19,11 @@ class Spinner {
|
|
|
19
19
|
|
|
20
20
|
if (!this.isSpinnerDisabled || (external && this.canForce)) {
|
|
21
21
|
const text = format(label, context);
|
|
22
|
-
this.ora
|
|
22
|
+
this.ora(awaitTask, text);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
return awaitTask;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
export default Spinner;
|
package/lib/util.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { EOL } from 'os';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import gitUrlParse from 'git-url-parse';
|
|
5
|
+
import semver from 'semver';
|
|
6
|
+
import osName from 'os-name';
|
|
7
|
+
import Log from './log.js';
|
|
8
|
+
|
|
9
|
+
const readJSON = file => JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
10
|
+
|
|
11
|
+
const pkg = readJSON(new URL('../package.json', import.meta.url));
|
|
9
12
|
|
|
10
13
|
const log = new Log();
|
|
11
14
|
|
|
@@ -87,7 +90,7 @@ const parseVersion = raw => {
|
|
|
87
90
|
|
|
88
91
|
const e = (message, docs) => new Error(docs ? `${message}${EOL}Documentation: ${docs}${EOL}` : message);
|
|
89
92
|
|
|
90
|
-
|
|
93
|
+
export {
|
|
91
94
|
getSystemInfo,
|
|
92
95
|
clean,
|
|
93
96
|
format,
|
|
@@ -97,5 +100,6 @@ module.exports = {
|
|
|
97
100
|
parseGitUrl,
|
|
98
101
|
hasAccess,
|
|
99
102
|
parseVersion,
|
|
103
|
+
readJSON,
|
|
100
104
|
e
|
|
101
105
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-it",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0-esm.3",
|
|
4
4
|
"description": "Generic CLI tool to automate versioning and package publishing related tasks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build",
|
|
@@ -35,7 +35,11 @@
|
|
|
35
35
|
"bin": {
|
|
36
36
|
"release-it": "bin/release-it.js"
|
|
37
37
|
},
|
|
38
|
-
"
|
|
38
|
+
"type": "module",
|
|
39
|
+
"exports": {
|
|
40
|
+
".": "./lib/index.js",
|
|
41
|
+
"./test/util": "./test/util/index.js"
|
|
42
|
+
},
|
|
39
43
|
"files": [
|
|
40
44
|
"bin",
|
|
41
45
|
"config",
|
|
@@ -45,7 +49,7 @@
|
|
|
45
49
|
"scripts": {
|
|
46
50
|
"lint": "eslint lib test",
|
|
47
51
|
"format": "prettier --write \"{lib,test}/**/*.js\"",
|
|
48
|
-
"test": "ava",
|
|
52
|
+
"test": "ava --timeout=20m",
|
|
49
53
|
"coverage": "nyc --reporter=lcov --reporter=html --config=config/.codecov.yml npm test",
|
|
50
54
|
"codecov": "nyc --reporter=json --config=config/.codecov.yml npm test && codecov -f coverage/coverage-final.json",
|
|
51
55
|
"readme": "markdown-toc README.md -i --maxdepth=2 --bullets=-",
|
|
@@ -62,22 +66,21 @@
|
|
|
62
66
|
"async-retry": "1.3.3",
|
|
63
67
|
"chalk": "4.1.2",
|
|
64
68
|
"cosmiconfig": "7.0.1",
|
|
65
|
-
"debug": "4.3.
|
|
69
|
+
"debug": "4.3.3",
|
|
66
70
|
"deprecated-obj": "2.0.0",
|
|
67
|
-
"execa": "
|
|
71
|
+
"execa": "6.0.0",
|
|
68
72
|
"form-data": "4.0.0",
|
|
69
73
|
"git-url-parse": "11.6.0",
|
|
70
|
-
"globby": "
|
|
74
|
+
"globby": "12.0.2",
|
|
71
75
|
"got": "11.8.3",
|
|
72
|
-
"import-cwd": "3.0.0",
|
|
73
76
|
"inquirer": "8.2.0",
|
|
74
77
|
"is-ci": "3.0.1",
|
|
75
78
|
"lodash": "4.17.21",
|
|
76
79
|
"mime-types": "2.1.34",
|
|
77
|
-
"new-github-release-url": "
|
|
78
|
-
"open": "
|
|
79
|
-
"ora": "
|
|
80
|
-
"os-name": "
|
|
80
|
+
"new-github-release-url": "2.0.0",
|
|
81
|
+
"open": "8.4.0",
|
|
82
|
+
"ora": "6.0.1",
|
|
83
|
+
"os-name": "5.0.1",
|
|
81
84
|
"parse-json": "5.2.0",
|
|
82
85
|
"semver": "7.3.5",
|
|
83
86
|
"shelljs": "0.8.4",
|
|
@@ -85,13 +88,13 @@
|
|
|
85
88
|
"url-join": "4.0.1",
|
|
86
89
|
"uuid": "8.3.2",
|
|
87
90
|
"yaml": "1.10.2",
|
|
88
|
-
"yargs-parser": "
|
|
91
|
+
"yargs-parser": "21.0.0"
|
|
89
92
|
},
|
|
90
93
|
"devDependencies": {
|
|
91
94
|
"@octokit/request-error": "2.1.0",
|
|
92
95
|
"ava": "3.15.0",
|
|
93
96
|
"codecov": "3.8.3",
|
|
94
|
-
"eslint": "8.
|
|
97
|
+
"eslint": "8.3.0",
|
|
95
98
|
"eslint-config-prettier": "8.3.0",
|
|
96
99
|
"eslint-plugin-ava": "13.1.0",
|
|
97
100
|
"eslint-plugin-import": "2.25.3",
|
|
@@ -101,12 +104,11 @@
|
|
|
101
104
|
"mock-stdio": "1.0.3",
|
|
102
105
|
"nock": "13.2.1",
|
|
103
106
|
"nyc": "15.1.0",
|
|
104
|
-
"prettier": "2.
|
|
105
|
-
"proxyquire": "2.1.3",
|
|
107
|
+
"prettier": "2.5.0",
|
|
106
108
|
"sinon": "12.0.1",
|
|
107
|
-
"strip-ansi": "
|
|
109
|
+
"strip-ansi": "7.0.1"
|
|
108
110
|
},
|
|
109
111
|
"engines": {
|
|
110
|
-
"node": ">=
|
|
112
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
111
113
|
}
|
|
112
114
|
}
|
package/test/cli.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import mockStdIo from 'mock-stdio';
|
|
3
|
+
import { version, help } from '../lib/cli.js';
|
|
4
|
+
import { readJSON } from '../lib/util.js';
|
|
5
|
+
|
|
6
|
+
const pkg = readJSON(new URL('../package.json', import.meta.url));
|
|
5
7
|
|
|
6
8
|
test('should print version', t => {
|
|
7
9
|
mockStdIo.start();
|
package/test/config.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import mock from 'mock-fs';
|
|
3
|
+
import isCI from 'is-ci';
|
|
4
|
+
import Config from '../lib/config.js';
|
|
5
|
+
import { readJSON } from '../lib/util.js';
|
|
6
|
+
|
|
7
|
+
const defaultConfig = readJSON(new URL('../config/release-it.json', import.meta.url));
|
|
5
8
|
|
|
6
9
|
const localConfig = { github: { release: true } };
|
|
7
10
|
|
|
@@ -43,7 +46,6 @@ test('should set CI mode', t => {
|
|
|
43
46
|
});
|
|
44
47
|
|
|
45
48
|
test('should detect CI mode', t => {
|
|
46
|
-
const isCI = require('is-ci');
|
|
47
49
|
const config = new Config();
|
|
48
50
|
t.is(config.options.ci, isCI);
|
|
49
51
|
t.is(config.isCI, isCI);
|
package/test/deprecated.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import sinon from 'sinon';
|
|
3
|
+
import deprecated from '../lib/deprecated.js';
|
|
4
|
+
import Log from '../lib/log.js';
|
|
5
5
|
|
|
6
6
|
test('should show deprecation warnings and return compliant object', t => {
|
|
7
7
|
const log = sinon.createStubInstance(Log);
|
package/test/git.init.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import sh from 'shelljs';
|
|
3
|
+
import Shell from '../lib/shell.js';
|
|
4
|
+
import Git from '../lib/plugin/git/Git.js';
|
|
5
|
+
import { readJSON } from '../lib/util.js';
|
|
6
|
+
import { factory } from './util/index.js';
|
|
7
|
+
import { mkTmpDir, gitAdd } from './util/helpers.js';
|
|
8
|
+
|
|
9
|
+
const { git } = readJSON(new URL('../config/release-it.json', import.meta.url));
|
|
8
10
|
|
|
9
11
|
test.serial.beforeEach(t => {
|
|
10
12
|
const bare = mkTmpDir();
|
package/test/git.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { EOL } from 'os';
|
|
2
|
+
import test from 'ava';
|
|
3
|
+
import sinon from 'sinon';
|
|
4
|
+
import sh from 'shelljs';
|
|
5
|
+
import Git from '../lib/plugin/git/Git.js';
|
|
6
|
+
import { factory } from './util/index.js';
|
|
7
|
+
import { mkTmpDir, readFile, gitAdd } from './util/helpers.js';
|
|
8
8
|
|
|
9
9
|
test.beforeEach(() => {
|
|
10
10
|
const tmp = mkTmpDir();
|
package/test/github.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import sinon from 'sinon';
|
|
3
|
+
import { RequestError } from '@octokit/request-error';
|
|
4
|
+
import GitHub from '../lib/plugin/github/GitHub.js';
|
|
5
|
+
import { factory, runTasks } from './util/index.js';
|
|
6
|
+
import {
|
|
7
7
|
interceptAuthentication,
|
|
8
8
|
interceptCollaborator,
|
|
9
9
|
interceptListReleases,
|
|
10
10
|
interceptCreate,
|
|
11
11
|
interceptUpdate,
|
|
12
12
|
interceptAsset
|
|
13
|
-
}
|
|
13
|
+
} from './stub/github.js';
|
|
14
14
|
|
|
15
15
|
const tokenRef = 'GITHUB_TOKEN';
|
|
16
16
|
const pushRepo = 'git://github.com:user/repo';
|
|
@@ -56,6 +56,7 @@ test('should release and upload assets', async t => {
|
|
|
56
56
|
};
|
|
57
57
|
const github = factory(GitHub, { options });
|
|
58
58
|
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
59
|
+
exec.withArgs('git log --pretty=format:"* %s (%h)" ${from}...${to}').resolves('');
|
|
59
60
|
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('2.0.1');
|
|
60
61
|
|
|
61
62
|
interceptAuthentication();
|
|
@@ -85,6 +86,7 @@ test('should create a pre-release and draft release notes', async t => {
|
|
|
85
86
|
};
|
|
86
87
|
const github = factory(GitHub, { options });
|
|
87
88
|
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
89
|
+
exec.withArgs('git log --pretty=format:"* %s (%h)" ${from}...${to}').resolves('');
|
|
88
90
|
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('2.0.1');
|
|
89
91
|
|
|
90
92
|
interceptAuthentication();
|
|
@@ -116,6 +118,7 @@ test('should update release and upload assets', async t => {
|
|
|
116
118
|
};
|
|
117
119
|
const github = factory(GitHub, { options });
|
|
118
120
|
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
121
|
+
exec.withArgs('git log --pretty=format:"* %s (%h)" ${from}...${to}').resolves('');
|
|
119
122
|
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('2.0.1');
|
|
120
123
|
exec.withArgs('git rev-list 2.0.1 --tags --max-count=1').resolves('a123456');
|
|
121
124
|
exec.withArgs('git describe --tags --abbrev=0 "a123456^"').resolves('2.0.1');
|
|
@@ -149,6 +152,7 @@ test('should create new release for unreleased tag', async t => {
|
|
|
149
152
|
};
|
|
150
153
|
const github = factory(GitHub, { options });
|
|
151
154
|
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
155
|
+
exec.withArgs('git log --pretty=format:"* %s (%h)" ${from}...${to}').resolves('');
|
|
152
156
|
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('2.0.1');
|
|
153
157
|
exec.withArgs('git rev-list 2.0.1 --tags --max-count=1').resolves('b123456');
|
|
154
158
|
exec.withArgs('git describe --tags --abbrev=0 "b123456^"').resolves('2.0.1');
|
|
@@ -202,6 +206,7 @@ test('should release to alternative host and proxy', async t => {
|
|
|
202
206
|
};
|
|
203
207
|
const github = factory(GitHub, { options });
|
|
204
208
|
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
209
|
+
exec.withArgs('git log --pretty=format:"* %s (%h)" ${from}...${to}').resolves('');
|
|
205
210
|
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('1.0.0');
|
|
206
211
|
|
|
207
212
|
await runTasks(github);
|
|
@@ -218,6 +223,7 @@ test('should release to git.pushRepo', async t => {
|
|
|
218
223
|
const options = { git: { pushRepo: 'upstream', changelog: null }, github: { tokenRef, skipChecks: true } };
|
|
219
224
|
const github = factory(GitHub, { options });
|
|
220
225
|
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
226
|
+
exec.withArgs('git log --pretty=format:"* %s (%h)" ${from}...${to}').resolves('');
|
|
221
227
|
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('1.0.0');
|
|
222
228
|
exec.withArgs('git remote get-url upstream').resolves('https://my-custom-host.org/user/repo');
|
|
223
229
|
|
|
@@ -229,7 +235,9 @@ test('should release to git.pushRepo', async t => {
|
|
|
229
235
|
exec.restore();
|
|
230
236
|
});
|
|
231
237
|
|
|
232
|
-
|
|
238
|
+
const testSkipOnActions = process.env.GITHUB_ACTIONS ? test.skip : test;
|
|
239
|
+
|
|
240
|
+
testSkipOnActions('should throw for unauthenticated user', async t => {
|
|
233
241
|
const options = { github: { tokenRef, pushRepo, host } };
|
|
234
242
|
const github = factory(GitHub, { options });
|
|
235
243
|
const stub = sinon.stub(github.client.users, 'getAuthenticated');
|
|
@@ -243,7 +251,7 @@ test('should throw for unauthenticated user', async t => {
|
|
|
243
251
|
stub.restore();
|
|
244
252
|
});
|
|
245
253
|
|
|
246
|
-
|
|
254
|
+
testSkipOnActions('should throw for non-collaborator', async t => {
|
|
247
255
|
interceptAuthentication({ username: 'john' });
|
|
248
256
|
const options = { github: { tokenRef, pushRepo, host } };
|
|
249
257
|
const github = factory(GitHub, { options });
|
|
@@ -256,8 +264,11 @@ test('should throw for non-collaborator', async t => {
|
|
|
256
264
|
});
|
|
257
265
|
|
|
258
266
|
test.serial('should skip authentication and collaborator checks when running on GitHub Actions', async t => {
|
|
259
|
-
|
|
260
|
-
|
|
267
|
+
const { GITHUB_ACTIONS, GITHUB_ACTOR } = process.env;
|
|
268
|
+
if (!GITHUB_ACTIONS) {
|
|
269
|
+
process.env.GITHUB_ACTIONS = 1;
|
|
270
|
+
process.env.GITHUB_ACTOR = 'webpro';
|
|
271
|
+
}
|
|
261
272
|
|
|
262
273
|
const options = { github: { tokenRef } };
|
|
263
274
|
const github = factory(GitHub, { options });
|
|
@@ -268,12 +279,15 @@ test.serial('should skip authentication and collaborator checks when running on
|
|
|
268
279
|
|
|
269
280
|
t.is(authStub.callCount, 0);
|
|
270
281
|
t.is(collaboratorStub.callCount, 0);
|
|
271
|
-
t.is(github.getContext('username'), '
|
|
282
|
+
t.is(github.getContext('username'), 'webpro');
|
|
272
283
|
|
|
273
284
|
authStub.restore();
|
|
274
285
|
collaboratorStub.restore();
|
|
275
|
-
|
|
276
|
-
|
|
286
|
+
|
|
287
|
+
if (!GITHUB_ACTIONS) {
|
|
288
|
+
process.env.GITHUB_ACTIONS = GITHUB_ACTIONS || '';
|
|
289
|
+
process.env.GITHUB_ACTOR = GITHUB_ACTOR || '';
|
|
290
|
+
}
|
|
277
291
|
});
|
|
278
292
|
|
|
279
293
|
test('should handle octokit client error (without retries)', async t => {
|
|
@@ -308,6 +322,7 @@ test('should not call octokit client in dry run', async t => {
|
|
|
308
322
|
const github = factory(GitHub, { options });
|
|
309
323
|
const spy = sinon.spy(github, 'client', ['get']);
|
|
310
324
|
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
325
|
+
exec.withArgs('git log --pretty=format:"* %s (%h)" ${from}...${to}').resolves('');
|
|
311
326
|
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('v1.0.0');
|
|
312
327
|
|
|
313
328
|
await runTasks(github);
|
|
@@ -330,7 +345,6 @@ test('should skip checks', async t => {
|
|
|
330
345
|
|
|
331
346
|
test('should generate GitHub web release url', async t => {
|
|
332
347
|
const options = {
|
|
333
|
-
git,
|
|
334
348
|
github: {
|
|
335
349
|
pushRepo,
|
|
336
350
|
release: true,
|
|
@@ -341,6 +355,7 @@ test('should generate GitHub web release url', async t => {
|
|
|
341
355
|
};
|
|
342
356
|
const github = factory(GitHub, { options });
|
|
343
357
|
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
358
|
+
exec.withArgs('git log --pretty=format:"* %s (%h)" ${from}...${to}').resolves('');
|
|
344
359
|
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('2.0.1');
|
|
345
360
|
|
|
346
361
|
await runTasks(github);
|
|
@@ -353,3 +368,30 @@ test('should generate GitHub web release url', async t => {
|
|
|
353
368
|
);
|
|
354
369
|
exec.restore();
|
|
355
370
|
});
|
|
371
|
+
|
|
372
|
+
test('should generate GitHub web release url for enterprise host', async t => {
|
|
373
|
+
const options = {
|
|
374
|
+
github: {
|
|
375
|
+
pushRepo: 'git://my-custom-host.org:user/repo',
|
|
376
|
+
release: true,
|
|
377
|
+
web: true,
|
|
378
|
+
host: 'my-custom-host.org',
|
|
379
|
+
releaseName: 'The Launch',
|
|
380
|
+
releaseNotes: 'echo It happened'
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
const github = factory(GitHub, { options });
|
|
384
|
+
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
385
|
+
exec.withArgs('git log --pretty=format:"* %s (%h)" ${from}...${to}').resolves('');
|
|
386
|
+
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('2.0.1');
|
|
387
|
+
|
|
388
|
+
await runTasks(github);
|
|
389
|
+
|
|
390
|
+
const { isReleased, releaseUrl } = github.getContext();
|
|
391
|
+
t.true(isReleased);
|
|
392
|
+
t.is(
|
|
393
|
+
releaseUrl,
|
|
394
|
+
'https://my-custom-host.org/user/repo/releases/new?tag=2.0.2&title=The+Launch&body=It+happened&prerelease=false'
|
|
395
|
+
);
|
|
396
|
+
exec.restore();
|
|
397
|
+
});
|
package/test/gitlab.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import sinon from 'sinon';
|
|
3
|
+
import nock from 'nock';
|
|
4
|
+
import GitLab from '../lib/plugin/gitlab/GitLab.js';
|
|
5
|
+
import { factory, runTasks } from './util/index.js';
|
|
6
|
+
import {
|
|
6
7
|
interceptUser,
|
|
7
8
|
interceptCollaborator,
|
|
8
9
|
interceptCollaboratorFallback,
|
|
9
10
|
interceptPublish,
|
|
10
11
|
interceptAsset
|
|
11
|
-
}
|
|
12
|
-
const { factory, runTasks } = require('./util');
|
|
12
|
+
} from './stub/gitlab.js';
|
|
13
13
|
|
|
14
14
|
const tokenHeader = 'Private-Token';
|
|
15
15
|
const tokenRef = 'GITLAB_TOKEN';
|
package/test/log.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { EOL } from 'os';
|
|
2
|
+
import test from 'ava';
|
|
3
|
+
import mockStdIo from 'mock-stdio';
|
|
4
|
+
import stripAnsi from 'strip-ansi';
|
|
5
|
+
import Log from '../lib/log.js';
|
|
6
6
|
|
|
7
7
|
test('should write to stdout', t => {
|
|
8
8
|
const log = new Log();
|
package/test/metrics.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import sinon from 'sinon';
|
|
3
|
+
import Metrics from '../lib/metrics.js';
|
|
4
4
|
|
|
5
5
|
test('should send metrics', async t => {
|
|
6
6
|
const stub = sinon.stub().resolves();
|
package/test/npm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import test from 'ava';
|
|
3
|
+
import sinon from 'sinon';
|
|
4
|
+
import mock from 'mock-fs';
|
|
5
|
+
import npm from '../lib/plugin/npm/npm.js';
|
|
6
|
+
import { factory, runTasks } from './util/index.js';
|
|
7
|
+
import { getArgs } from './util/helpers.js';
|
|
8
8
|
|
|
9
9
|
test('should return npm package url', t => {
|
|
10
10
|
const options = { npm: { name: 'my-cool-package' } };
|
|
@@ -279,7 +279,6 @@ test('should skip checks', async t => {
|
|
|
279
279
|
});
|
|
280
280
|
|
|
281
281
|
test('should publish to a different/scoped registry', async t => {
|
|
282
|
-
delete require.cache[require.resolve('../package.json')];
|
|
283
282
|
mock({
|
|
284
283
|
[path.resolve('package.json')]: JSON.stringify({
|
|
285
284
|
name: '@my-scope/my-pkg',
|
|
@@ -317,7 +316,6 @@ test('should publish to a different/scoped registry', async t => {
|
|
|
317
316
|
});
|
|
318
317
|
|
|
319
318
|
test('should not publish when `npm version` fails', async t => {
|
|
320
|
-
delete require.cache[require.resolve('../package.json')];
|
|
321
319
|
mock({
|
|
322
320
|
[path.resolve('package.json')]: JSON.stringify({
|
|
323
321
|
name: '@my-scope/my-pkg',
|