release-it 14.12.5 → 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/config/release-it.json +1 -0
- package/lib/plugin/git/Git.js +2 -1
- package/lib/plugin/npm/npm.js +2 -1
- package/package.json +2 -1
- package/test/git.init.js +13 -0
- package/test/npm.js +9 -0
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() {
|
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/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",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"update-notifier": "5.1.0",
|
|
82
82
|
"url-join": "4.0.1",
|
|
83
83
|
"uuid": "8.3.2",
|
|
84
|
+
"wildcard-match": "5.1.2",
|
|
84
85
|
"yaml": "1.10.2",
|
|
85
86
|
"yargs-parser": "20.2.9"
|
|
86
87
|
},
|
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/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
|
+
});
|