release-it 14.12.0 → 14.12.4
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 +0 -1
- package/lib/plugin/github/GitHub.js +6 -2
- package/lib/tasks.js +1 -2
- package/package.json +5 -9
- package/test/github.js +5 -3
- package/test/stub/github.js +15 -8
- package/test/util/index.js +1 -1
- package/config/.codecov.yml +0 -5
- package/config/deprecated.json +0 -1
- package/lib/deprecated.js +0 -20
- package/test/deprecated.js +0 -11
package/README.md
CHANGED
|
@@ -19,7 +19,6 @@ system, and hooks to execute any command you need to test, build, and/or publish
|
|
|
19
19
|
|
|
20
20
|
[](https://github.com/release-it/release-it/actions)
|
|
21
21
|
[](https://www.npmjs.com/package/release-it)
|
|
22
|
-
[](https://codecov.io/gh/release-it/release-it)
|
|
23
22
|
|
|
24
23
|
## Links
|
|
25
24
|
|
|
@@ -37,7 +37,7 @@ class GitHub extends Release {
|
|
|
37
37
|
async init() {
|
|
38
38
|
await super.init();
|
|
39
39
|
|
|
40
|
-
const { skipChecks, tokenRef, web, update } = this.options;
|
|
40
|
+
const { skipChecks, tokenRef, web, update, assets } = this.options;
|
|
41
41
|
|
|
42
42
|
if (!this.token || web) {
|
|
43
43
|
if (!web) {
|
|
@@ -48,6 +48,10 @@ class GitHub extends Release {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
if (web && assets) {
|
|
52
|
+
this.log.warn('Assets are not included in web-based releases.');
|
|
53
|
+
}
|
|
54
|
+
|
|
51
55
|
if (!skipChecks) {
|
|
52
56
|
// If we're running on GitHub Actions, we can skip the authentication and
|
|
53
57
|
// collaborator checks. Ref: https://bit.ly/2vsyRzu
|
|
@@ -192,7 +196,7 @@ class GitHub extends Release {
|
|
|
192
196
|
const { version, releaseNotes } = this.getContext();
|
|
193
197
|
const { isPreRelease } = parseVersion(version);
|
|
194
198
|
const name = format(releaseName, this.config.getContext());
|
|
195
|
-
const body = autoGenerate ?
|
|
199
|
+
const body = autoGenerate ? '' : releaseNotes || '';
|
|
196
200
|
|
|
197
201
|
return Object.assign(options, {
|
|
198
202
|
owner,
|
package/lib/tasks.js
CHANGED
|
@@ -7,7 +7,6 @@ const Prompt = require('./prompt');
|
|
|
7
7
|
const Spinner = require('./spinner');
|
|
8
8
|
const Metrics = require('./metrics');
|
|
9
9
|
const { reduceUntil, parseVersion } = require('./util');
|
|
10
|
-
const handleDeprecated = require('./deprecated');
|
|
11
10
|
|
|
12
11
|
const runTasks = async (opts, di) => {
|
|
13
12
|
let container = {};
|
|
@@ -27,7 +26,7 @@ const runTasks = async (opts, di) => {
|
|
|
27
26
|
|
|
28
27
|
const { log, metrics, shell, spinner } = container;
|
|
29
28
|
|
|
30
|
-
const options =
|
|
29
|
+
const options = config.getContext();
|
|
31
30
|
|
|
32
31
|
metrics.trackEvent('start', options);
|
|
33
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-it",
|
|
3
|
-
"version": "14.12.
|
|
3
|
+
"version": "14.12.4",
|
|
4
4
|
"description": "Generic CLI tool to automate versioning and package publishing related tasks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build",
|
|
@@ -46,8 +46,6 @@
|
|
|
46
46
|
"lint": "eslint lib test",
|
|
47
47
|
"format": "prettier --write \"{lib,test}/**/*.js\"",
|
|
48
48
|
"test": "ava",
|
|
49
|
-
"coverage": "nyc --reporter=lcov --reporter=html --config=config/.codecov.yml npm test",
|
|
50
|
-
"codecov": "nyc --reporter=json --config=config/.codecov.yml npm test && codecov -f coverage/coverage-final.json",
|
|
51
49
|
"readme": "markdown-toc README.md -i --maxdepth=2 --bullets=-",
|
|
52
50
|
"release": "./bin/release-it.js"
|
|
53
51
|
},
|
|
@@ -63,7 +61,6 @@
|
|
|
63
61
|
"chalk": "4.1.2",
|
|
64
62
|
"cosmiconfig": "7.0.1",
|
|
65
63
|
"debug": "4.3.3",
|
|
66
|
-
"deprecated-obj": "2.0.0",
|
|
67
64
|
"execa": "5.1.1",
|
|
68
65
|
"form-data": "4.0.0",
|
|
69
66
|
"git-url-parse": "11.6.0",
|
|
@@ -80,7 +77,7 @@
|
|
|
80
77
|
"os-name": "4.0.1",
|
|
81
78
|
"parse-json": "5.2.0",
|
|
82
79
|
"semver": "7.3.5",
|
|
83
|
-
"shelljs": "0.8.
|
|
80
|
+
"shelljs": "0.8.5",
|
|
84
81
|
"update-notifier": "5.1.0",
|
|
85
82
|
"url-join": "4.0.1",
|
|
86
83
|
"uuid": "8.3.2",
|
|
@@ -90,8 +87,7 @@
|
|
|
90
87
|
"devDependencies": {
|
|
91
88
|
"@octokit/request-error": "2.1.0",
|
|
92
89
|
"ava": "3.15.0",
|
|
93
|
-
"
|
|
94
|
-
"eslint": "8.6.0",
|
|
90
|
+
"eslint": "8.7.0",
|
|
95
91
|
"eslint-config-prettier": "8.3.0",
|
|
96
92
|
"eslint-plugin-ava": "13.2.0",
|
|
97
93
|
"eslint-plugin-import": "2.25.4",
|
|
@@ -99,8 +95,8 @@
|
|
|
99
95
|
"markdown-toc": "1.2.0",
|
|
100
96
|
"mock-fs": "5.1.2",
|
|
101
97
|
"mock-stdio": "1.0.3",
|
|
102
|
-
"nock": "13.2.
|
|
103
|
-
"
|
|
98
|
+
"nock": "13.2.2",
|
|
99
|
+
"node-fetch": "2.6.7",
|
|
104
100
|
"prettier": "2.5.1",
|
|
105
101
|
"proxyquire": "2.1.3",
|
|
106
102
|
"sinon": "12.0.1",
|
package/test/github.js
CHANGED
|
@@ -15,7 +15,7 @@ const {
|
|
|
15
15
|
const tokenRef = 'GITHUB_TOKEN';
|
|
16
16
|
const pushRepo = 'git://github.com:user/repo';
|
|
17
17
|
const host = 'github.com';
|
|
18
|
-
const git = { changelog:
|
|
18
|
+
const git = { changelog: '' };
|
|
19
19
|
const requestErrorOptions = { request: { url: '', headers: {} }, response: { headers: {} } };
|
|
20
20
|
|
|
21
21
|
test.serial('should check token and perform checks', async t => {
|
|
@@ -89,7 +89,7 @@ test('should create a pre-release and draft release notes', async t => {
|
|
|
89
89
|
|
|
90
90
|
interceptAuthentication();
|
|
91
91
|
interceptCollaborator();
|
|
92
|
-
interceptCreate({ body: { tag_name: '2.0.2', name: 'Release 2.0.2', body:
|
|
92
|
+
interceptCreate({ body: { tag_name: '2.0.2', name: 'Release 2.0.2', body: '', prerelease: true, draft: true } });
|
|
93
93
|
|
|
94
94
|
await runTasks(github);
|
|
95
95
|
|
|
@@ -244,7 +244,7 @@ test('should release to alternative host and proxy', async t => {
|
|
|
244
244
|
test('should release to git.pushRepo', async t => {
|
|
245
245
|
const remote = { api: 'https://my-custom-host.org/api/v3', host: 'my-custom-host.org' };
|
|
246
246
|
interceptCreate(Object.assign({ body: { tag_name: '1.0.1' } }, remote));
|
|
247
|
-
const options = { git: { pushRepo: 'upstream', changelog:
|
|
247
|
+
const options = { git: { pushRepo: 'upstream', changelog: '' }, github: { tokenRef, skipChecks: true } };
|
|
248
248
|
const github = factory(GitHub, { options });
|
|
249
249
|
const exec = sinon.stub(github.shell, 'exec').callThrough();
|
|
250
250
|
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('1.0.0');
|
|
@@ -359,6 +359,7 @@ test('should skip checks', async t => {
|
|
|
359
359
|
|
|
360
360
|
test('should generate GitHub web release url', async t => {
|
|
361
361
|
const options = {
|
|
362
|
+
git,
|
|
362
363
|
github: {
|
|
363
364
|
pushRepo,
|
|
364
365
|
release: true,
|
|
@@ -384,6 +385,7 @@ test('should generate GitHub web release url', async t => {
|
|
|
384
385
|
|
|
385
386
|
test('should generate GitHub web release url for enterprise host', async t => {
|
|
386
387
|
const options = {
|
|
388
|
+
git,
|
|
387
389
|
github: {
|
|
388
390
|
pushRepo: 'git://my-custom-host.org:user/repo',
|
|
389
391
|
release: true,
|
package/test/stub/github.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
const nock = require('nock');
|
|
2
2
|
|
|
3
|
-
const interceptAuthentication = ({ api = 'https://api.github.com', username = 'john' } = {}) =>
|
|
3
|
+
const interceptAuthentication = ({ api = 'https://api.github.com', username = 'john' } = {}) => {
|
|
4
4
|
nock(api).get('/user').reply(200, {
|
|
5
5
|
login: username
|
|
6
6
|
});
|
|
7
|
+
};
|
|
7
8
|
|
|
8
9
|
const interceptCollaborator = ({
|
|
9
10
|
api = 'https://api.github.com',
|
|
10
11
|
owner = 'user',
|
|
11
12
|
project = 'repo',
|
|
12
13
|
username = 'john'
|
|
13
|
-
} = {}) =>
|
|
14
|
+
} = {}) => {
|
|
15
|
+
nock(api).get(`/repos/${owner}/${project}/collaborators/${username}`).reply(204);
|
|
16
|
+
};
|
|
14
17
|
|
|
15
18
|
const interceptListReleases = ({
|
|
16
19
|
host = 'github.com',
|
|
@@ -18,7 +21,7 @@ const interceptListReleases = ({
|
|
|
18
21
|
owner = 'user',
|
|
19
22
|
project = 'repo',
|
|
20
23
|
tag_name
|
|
21
|
-
} = {}) =>
|
|
24
|
+
} = {}) => {
|
|
22
25
|
nock(api)
|
|
23
26
|
.get(`/repos/${owner}/${project}/releases?per_page=1&page=1`)
|
|
24
27
|
.reply(200, [
|
|
@@ -34,14 +37,15 @@ const interceptListReleases = ({
|
|
|
34
37
|
prerelease: false
|
|
35
38
|
}
|
|
36
39
|
]);
|
|
40
|
+
};
|
|
37
41
|
|
|
38
42
|
const interceptCreate = ({
|
|
39
43
|
api = 'https://api.github.com',
|
|
40
44
|
host = 'github.com',
|
|
41
45
|
owner = 'user',
|
|
42
46
|
project = 'repo',
|
|
43
|
-
body: { tag_name, name = '', body =
|
|
44
|
-
} = {}) =>
|
|
47
|
+
body: { tag_name, name = '', body = '', prerelease = false, draft = false, generate_release_notes = false }
|
|
48
|
+
} = {}) => {
|
|
45
49
|
nock(api)
|
|
46
50
|
.post(`/repos/${owner}/${project}/releases`, {
|
|
47
51
|
tag_name,
|
|
@@ -66,14 +70,15 @@ const interceptCreate = ({
|
|
|
66
70
|
};
|
|
67
71
|
return [200, responseBody, { location: `${api}/repos/${owner}/${project}/releases/${id}` }];
|
|
68
72
|
});
|
|
73
|
+
};
|
|
69
74
|
|
|
70
75
|
const interceptUpdate = ({
|
|
71
76
|
host = 'github.com',
|
|
72
77
|
api = 'https://api.github.com',
|
|
73
78
|
owner = 'user',
|
|
74
79
|
project = 'repo',
|
|
75
|
-
body: { tag_name, name = '', body =
|
|
76
|
-
} = {}) =>
|
|
80
|
+
body: { tag_name, name = '', body = '', prerelease = false, draft = false, generate_release_notes = false }
|
|
81
|
+
} = {}) => {
|
|
77
82
|
nock(api)
|
|
78
83
|
.patch(`/repos/${owner}/${project}/releases/1`, { tag_name, name, body, draft, prerelease, generate_release_notes })
|
|
79
84
|
.reply(200, {
|
|
@@ -87,6 +92,7 @@ const interceptUpdate = ({
|
|
|
87
92
|
upload_url: `https://uploads.${host}/repos/${owner}/${project}/releases/1/assets{?name,label}`,
|
|
88
93
|
html_url: `https://${host}/${owner}/${project}/releases/tag/${tag_name}`
|
|
89
94
|
});
|
|
95
|
+
};
|
|
90
96
|
|
|
91
97
|
const interceptAsset = ({
|
|
92
98
|
api = 'https://api.github.com',
|
|
@@ -95,7 +101,7 @@ const interceptAsset = ({
|
|
|
95
101
|
project = 'repo',
|
|
96
102
|
tagName,
|
|
97
103
|
body = {}
|
|
98
|
-
} = {}) =>
|
|
104
|
+
} = {}) => {
|
|
99
105
|
nock(`https://uploads.${host}`)
|
|
100
106
|
.post(`/repos/${owner}/${project}/releases/1/assets`, body)
|
|
101
107
|
.query(true)
|
|
@@ -112,6 +118,7 @@ const interceptAsset = ({
|
|
|
112
118
|
browser_download_url: `https://${host}/${owner}/${project}/releases/download/${tagName}/${name}`
|
|
113
119
|
};
|
|
114
120
|
});
|
|
121
|
+
};
|
|
115
122
|
|
|
116
123
|
module.exports = {
|
|
117
124
|
interceptAuthentication,
|
package/test/util/index.js
CHANGED
|
@@ -47,7 +47,7 @@ module.exports.runTasks = async plugin => {
|
|
|
47
47
|
|
|
48
48
|
const name = (await plugin.getName()) || '__test__';
|
|
49
49
|
const latestVersion = (await plugin.getLatestVersion()) || '1.0.0';
|
|
50
|
-
const changelog = (await plugin.getChangelog()) || null;
|
|
50
|
+
const changelog = (await plugin.getChangelog(latestVersion)) || null;
|
|
51
51
|
const increment = getIncrement(plugin);
|
|
52
52
|
|
|
53
53
|
plugin.config.setContext({ name, latestVersion, latestTag: latestVersion, changelog });
|
package/config/.codecov.yml
DELETED
package/config/deprecated.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
package/lib/deprecated.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const Deprecated = require('deprecated-obj');
|
|
2
|
-
const deprecated = require('../config/deprecated.json');
|
|
3
|
-
const Log = require('./log');
|
|
4
|
-
|
|
5
|
-
module.exports = (config, log = new Log()) => {
|
|
6
|
-
const deprecations = new Deprecated(deprecated, config);
|
|
7
|
-
const compliant = deprecations.getCompliant();
|
|
8
|
-
const violations = deprecations.getViolations();
|
|
9
|
-
if (Object.keys(violations).length > 0) {
|
|
10
|
-
log.warn(`Deprecated configuration options found. Please migrate before the next major release.`);
|
|
11
|
-
}
|
|
12
|
-
for (const d in violations) {
|
|
13
|
-
log.warn(
|
|
14
|
-
`The "${d}" option is deprecated. ${
|
|
15
|
-
violations[d] ? (/^[A-Z]/.test(violations[d]) ? violations[d] : `Please use "${violations[d]}" instead.`) : ''
|
|
16
|
-
}`
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
return compliant;
|
|
20
|
-
};
|
package/test/deprecated.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const test = require('ava');
|
|
2
|
-
const sinon = require('sinon');
|
|
3
|
-
const deprecated = require('../lib/deprecated');
|
|
4
|
-
const Log = require('../lib/log');
|
|
5
|
-
|
|
6
|
-
test('should show deprecation warnings and return compliant object', t => {
|
|
7
|
-
const log = sinon.createStubInstance(Log);
|
|
8
|
-
const config = deprecated({ keep: 1 }, log);
|
|
9
|
-
t.is(log.warn.callCount, 0);
|
|
10
|
-
t.deepEqual(config, { keep: 1 });
|
|
11
|
-
});
|