release-it 14.12.3 → 14.13.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/README.md +0 -1
- package/config/release-it.json +1 -0
- package/lib/plugin/git/Git.js +2 -1
- package/lib/plugin/github/GitHub.js +2 -2
- package/lib/plugin/npm/npm.js +2 -1
- package/lib/tasks.js +1 -2
- package/package.json +3 -6
- package/test/git.init.js +13 -0
- package/test/git.js +4 -1
- package/test/github.js +3 -5
- package/test/npm.js +9 -0
- package/test/stub/github.js +2 -2
- 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
|
|
package/config/release-it.json
CHANGED
package/lib/plugin/git/Git.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { EOL } = require('os');
|
|
2
2
|
const _ = require('lodash');
|
|
3
3
|
const execa = require('execa');
|
|
4
|
+
const matcher = require('wildcard-match');
|
|
4
5
|
const { format, e } = require('../../util');
|
|
5
6
|
const GitBase = require('../GitBase');
|
|
6
7
|
const prompts = require('./prompts');
|
|
@@ -94,7 +95,7 @@ class Git extends GitBase {
|
|
|
94
95
|
async isRequiredBranch() {
|
|
95
96
|
const branch = await this.getBranchName();
|
|
96
97
|
const requiredBranches = _.castArray(this.options.requireBranch);
|
|
97
|
-
return requiredBranches
|
|
98
|
+
return matcher(requiredBranches)(branch);
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
async hasUpstreamBranch() {
|
|
@@ -193,10 +193,10 @@ class GitHub extends Release {
|
|
|
193
193
|
const { owner, project: repo } = this.getContext('repo');
|
|
194
194
|
const { releaseName, draft = false, preRelease = false, autoGenerate = false } = this.options;
|
|
195
195
|
const { tagName } = this.config.getContext();
|
|
196
|
-
const { version, releaseNotes } = this.getContext();
|
|
196
|
+
const { version, releaseNotes, isUpdate } = this.getContext();
|
|
197
197
|
const { isPreRelease } = parseVersion(version);
|
|
198
198
|
const name = format(releaseName, this.config.getContext());
|
|
199
|
-
const body = autoGenerate ? '' : releaseNotes
|
|
199
|
+
const body = autoGenerate ? (isUpdate ? null : '') : releaseNotes;
|
|
200
200
|
|
|
201
201
|
return Object.assign(options, {
|
|
202
202
|
owner,
|
package/lib/plugin/npm/npm.js
CHANGED
|
@@ -82,7 +82,8 @@ class npm extends Plugin {
|
|
|
82
82
|
|
|
83
83
|
if (!this.config.isIncrement) return false;
|
|
84
84
|
|
|
85
|
-
const
|
|
85
|
+
const allowSameVersion = this.options.allowSameVersion ? ' --allow-same-version' : '';
|
|
86
|
+
const task = () => this.exec(`npm version ${version} --no-git-tag-version${allowSameVersion}`);
|
|
86
87
|
return this.spinner.show({ task, label: 'npm version' });
|
|
87
88
|
}
|
|
88
89
|
|
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.
|
|
3
|
+
"version": "14.13.0",
|
|
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",
|
|
@@ -84,13 +81,13 @@
|
|
|
84
81
|
"update-notifier": "5.1.0",
|
|
85
82
|
"url-join": "4.0.1",
|
|
86
83
|
"uuid": "8.3.2",
|
|
84
|
+
"wildcard-match": "5.1.2",
|
|
87
85
|
"yaml": "1.10.2",
|
|
88
86
|
"yargs-parser": "20.2.9"
|
|
89
87
|
},
|
|
90
88
|
"devDependencies": {
|
|
91
89
|
"@octokit/request-error": "2.1.0",
|
|
92
90
|
"ava": "3.15.0",
|
|
93
|
-
"codecov": "3.8.3",
|
|
94
91
|
"eslint": "8.7.0",
|
|
95
92
|
"eslint-config-prettier": "8.3.0",
|
|
96
93
|
"eslint-plugin-ava": "13.2.0",
|
|
@@ -100,7 +97,7 @@
|
|
|
100
97
|
"mock-fs": "5.1.2",
|
|
101
98
|
"mock-stdio": "1.0.3",
|
|
102
99
|
"nock": "13.2.2",
|
|
103
|
-
"
|
|
100
|
+
"node-fetch": "2.6.7",
|
|
104
101
|
"prettier": "2.5.1",
|
|
105
102
|
"proxyquire": "2.1.3",
|
|
106
103
|
"sinon": "12.0.1",
|
package/test/git.init.js
CHANGED
|
@@ -24,6 +24,19 @@ test.serial('should throw if on wrong branch', async t => {
|
|
|
24
24
|
await t.throwsAsync(gitClient.init(), { message: /^Must be on branch dev/ });
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
+
test.serial('should not throw if required branch matches', async t => {
|
|
28
|
+
const options = { git: { requireBranch: 'ma?*' } };
|
|
29
|
+
const gitClient = factory(Git, { options });
|
|
30
|
+
await t.notThrowsAsync(gitClient.init());
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test.serial('should not throw if one of required branch matches', async t => {
|
|
34
|
+
const options = { git: { requireBranch: ['release/*', 'hotfix/*'] } };
|
|
35
|
+
const gitClient = factory(Git, { options });
|
|
36
|
+
sh.exec('git checkout -b release/v1');
|
|
37
|
+
await t.notThrowsAsync(gitClient.init());
|
|
38
|
+
});
|
|
39
|
+
|
|
27
40
|
test.serial('should throw if there is no remote Git url', async t => {
|
|
28
41
|
const gitClient = factory(Git, { options: { git } });
|
|
29
42
|
sh.exec('git remote remove origin');
|
package/test/git.js
CHANGED
|
@@ -228,7 +228,10 @@ test.serial('should push to remote name (not "origin")', async t => {
|
|
|
228
228
|
gitAdd('line', 'file', 'Add file');
|
|
229
229
|
await gitClient.push();
|
|
230
230
|
t.deepEqual(spy.lastCall.args[0], ['git', 'push', '--set-upstream', 'upstream', 'foo']);
|
|
231
|
-
t.regex(
|
|
231
|
+
t.regex(
|
|
232
|
+
await spy.lastCall.returnValue,
|
|
233
|
+
/branch .?foo.? set up to track (remote branch .?foo.? from .?upstream.?|.?upstream\/foo.?)/i
|
|
234
|
+
);
|
|
232
235
|
}
|
|
233
236
|
spy.restore();
|
|
234
237
|
});
|
package/test/github.js
CHANGED
|
@@ -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',
|
|
92
|
+
interceptCreate({ body: { tag_name: '2.0.2', name: 'Release 2.0.2', prerelease: true, draft: true } });
|
|
93
93
|
|
|
94
94
|
await runTasks(github);
|
|
95
95
|
|
|
@@ -99,7 +99,7 @@ test('should create a pre-release and draft release notes', async t => {
|
|
|
99
99
|
exec.restore();
|
|
100
100
|
});
|
|
101
101
|
|
|
102
|
-
test('should create auto
|
|
102
|
+
test('should create auto-generated release notes', async t => {
|
|
103
103
|
const options = {
|
|
104
104
|
git,
|
|
105
105
|
github: {
|
|
@@ -116,9 +116,7 @@ test('should create auto generated release notes', async t => {
|
|
|
116
116
|
|
|
117
117
|
interceptAuthentication();
|
|
118
118
|
interceptCollaborator();
|
|
119
|
-
interceptCreate({
|
|
120
|
-
body: { tag_name: '2.0.2', name: 'Release 2.0.2', draft: false, prerelease: false, generate_release_notes: true }
|
|
121
|
-
});
|
|
119
|
+
interceptCreate({ body: { tag_name: '2.0.2', name: 'Release 2.0.2', generate_release_notes: true, body: '' } });
|
|
122
120
|
|
|
123
121
|
await runTasks(github);
|
|
124
122
|
|
package/test/npm.js
CHANGED
|
@@ -349,3 +349,12 @@ test('should not publish when `npm version` fails', async t => {
|
|
|
349
349
|
|
|
350
350
|
exec.restore();
|
|
351
351
|
});
|
|
352
|
+
|
|
353
|
+
test('should add allow-same-version argument', async t => {
|
|
354
|
+
const options = { npm: { skipChecks: true, allowSameVersion: true } };
|
|
355
|
+
const npmClient = factory(npm, { options });
|
|
356
|
+
const exec = sinon.stub(npmClient.shell, 'exec').resolves();
|
|
357
|
+
await runTasks(npmClient);
|
|
358
|
+
const version = exec.args.filter(arg => arg[0].startsWith('npm version'));
|
|
359
|
+
t.regex(version[0][0], / --allow-same-version/);
|
|
360
|
+
});
|
package/test/stub/github.js
CHANGED
|
@@ -44,7 +44,7 @@ const interceptCreate = ({
|
|
|
44
44
|
host = 'github.com',
|
|
45
45
|
owner = 'user',
|
|
46
46
|
project = 'repo',
|
|
47
|
-
body: { tag_name, name = '',
|
|
47
|
+
body: { tag_name, name = '', generate_release_notes = false, body = null, prerelease = false, draft = false }
|
|
48
48
|
} = {}) => {
|
|
49
49
|
nock(api)
|
|
50
50
|
.post(`/repos/${owner}/${project}/releases`, {
|
|
@@ -77,7 +77,7 @@ const interceptUpdate = ({
|
|
|
77
77
|
api = 'https://api.github.com',
|
|
78
78
|
owner = 'user',
|
|
79
79
|
project = 'repo',
|
|
80
|
-
body: { tag_name, name = '', body =
|
|
80
|
+
body: { tag_name, name = '', body = null, prerelease = false, draft = false, generate_release_notes = false }
|
|
81
81
|
} = {}) => {
|
|
82
82
|
nock(api)
|
|
83
83
|
.patch(`/repos/${owner}/${project}/releases/1`, { tag_name, name, body, draft, prerelease, generate_release_notes })
|
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
|
-
});
|