release-it 16.0.0 → 16.1.1
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 +2 -2
- package/config/release-it.json +1 -0
- package/lib/plugin/GitBase.js +14 -4
- package/lib/plugin/GitRelease.js +8 -1
- package/package.json +12 -12
- package/test/git.js +34 -0
package/README.md
CHANGED
|
@@ -334,8 +334,8 @@ release-it programmatically][45] for example code.
|
|
|
334
334
|
|
|
335
335
|
## Legacy Node.js
|
|
336
336
|
|
|
337
|
-
The latest major version is
|
|
338
|
-
environments running Node.js
|
|
337
|
+
The latest major version is v16, supporting Node.js 16 and up (as Node.js v14 is EOL). Use release-it v15 for
|
|
338
|
+
environments running Node.js v14. Also see [CHANGELOG.md][67].
|
|
339
339
|
|
|
340
340
|
## Links
|
|
341
341
|
|
package/config/release-it.json
CHANGED
package/lib/plugin/GitBase.js
CHANGED
|
@@ -94,10 +94,20 @@ class GitBase extends Plugin {
|
|
|
94
94
|
const context = Object.assign({}, this.config.getContext(), { version: '*' });
|
|
95
95
|
const match = format(this.options.tagMatch || this.options.tagName || '${version}', context);
|
|
96
96
|
const exclude = this.options.tagExclude ? ` --exclude=${format(this.options.tagExclude, context)}` : '';
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
if (this.options.getLatestTagFromAllRefs) {
|
|
98
|
+
return this.exec(
|
|
99
|
+
`git -c "versionsort.suffix=-" for-each-ref --count=1 --sort=-v:refname --format="%(refname:short)" refs/tags/${match}`,
|
|
100
|
+
{ options }
|
|
101
|
+
).then(
|
|
102
|
+
stdout => stdout || null,
|
|
103
|
+
() => null
|
|
104
|
+
);
|
|
105
|
+
} else {
|
|
106
|
+
return this.exec(`git describe --tags --match=${match} --abbrev=0${exclude}`, { options }).then(
|
|
107
|
+
stdout => stdout || null,
|
|
108
|
+
() => null
|
|
109
|
+
);
|
|
110
|
+
}
|
|
101
111
|
}
|
|
102
112
|
|
|
103
113
|
async getSecondLatestTagName(latestTag) {
|
package/lib/plugin/GitRelease.js
CHANGED
|
@@ -12,7 +12,14 @@ class GitRelease extends GitBase {
|
|
|
12
12
|
getInitialOptions(options) {
|
|
13
13
|
const baseOptions = super.getInitialOptions(...arguments);
|
|
14
14
|
const git = options.git || defaultConfig.git;
|
|
15
|
-
const gitOptions = _.pick(git, [
|
|
15
|
+
const gitOptions = _.pick(git, [
|
|
16
|
+
'tagExclude',
|
|
17
|
+
'tagName',
|
|
18
|
+
'tagMatch',
|
|
19
|
+
'getLatestTagFromAllRefs',
|
|
20
|
+
'pushRepo',
|
|
21
|
+
'changelog'
|
|
22
|
+
]);
|
|
16
23
|
return _.defaults(baseOptions, gitOptions);
|
|
17
24
|
}
|
|
18
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-it",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.1.1",
|
|
4
4
|
"description": "Generic CLI tool to automate versioning and package publishing-related tasks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build",
|
|
@@ -62,15 +62,15 @@
|
|
|
62
62
|
"license": "MIT",
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@iarna/toml": "2.2.5",
|
|
65
|
-
"@octokit/rest": "
|
|
65
|
+
"@octokit/rest": "20.0.1",
|
|
66
66
|
"async-retry": "1.3.3",
|
|
67
67
|
"chalk": "5.3.0",
|
|
68
68
|
"cosmiconfig": "8.2.0",
|
|
69
69
|
"execa": "7.1.1",
|
|
70
70
|
"git-url-parse": "13.1.0",
|
|
71
|
-
"globby": "13.2.
|
|
71
|
+
"globby": "13.2.2",
|
|
72
72
|
"got": "13.0.0",
|
|
73
|
-
"inquirer": "9.2.
|
|
73
|
+
"inquirer": "9.2.8",
|
|
74
74
|
"is-ci": "3.0.1",
|
|
75
75
|
"issue-parser": "6.0.0",
|
|
76
76
|
"lodash": "4.17.21",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"ora": "6.3.1",
|
|
82
82
|
"os-name": "5.1.0",
|
|
83
83
|
"promise.allsettled": "1.0.6",
|
|
84
|
-
"proxy-agent": "6.2.
|
|
85
|
-
"semver": "7.5.
|
|
84
|
+
"proxy-agent": "6.2.2",
|
|
85
|
+
"semver": "7.5.4",
|
|
86
86
|
"shelljs": "0.8.5",
|
|
87
87
|
"update-notifier": "6.0.2",
|
|
88
88
|
"url-join": "5.0.0",
|
|
@@ -90,18 +90,18 @@
|
|
|
90
90
|
"yargs-parser": "21.1.1"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@octokit/request-error": "
|
|
93
|
+
"@octokit/request-error": "5.0.0",
|
|
94
94
|
"ava": "5.3.1",
|
|
95
|
-
"eslint": "8.
|
|
95
|
+
"eslint": "8.45.0",
|
|
96
96
|
"eslint-config-prettier": "8.8.0",
|
|
97
97
|
"eslint-plugin-ava": "14.0.0",
|
|
98
98
|
"eslint-plugin-import": "2.27.5",
|
|
99
|
-
"eslint-plugin-prettier": "
|
|
100
|
-
"knip": "2.
|
|
99
|
+
"eslint-plugin-prettier": "5.0.0",
|
|
100
|
+
"knip": "2.15.5",
|
|
101
101
|
"mock-fs": "5.2.0",
|
|
102
102
|
"mock-stdio": "1.0.3",
|
|
103
|
-
"nock": "13.3.
|
|
104
|
-
"prettier": "
|
|
103
|
+
"nock": "13.3.2",
|
|
104
|
+
"prettier": "3.0.0",
|
|
105
105
|
"remark-cli": "11.0.0",
|
|
106
106
|
"remark-preset-webpro": "0.0.3",
|
|
107
107
|
"sinon": "15.2.0",
|
package/test/git.js
CHANGED
|
@@ -322,3 +322,37 @@ test.serial('should not roll back with risky config', async t => {
|
|
|
322
322
|
await gitClient.beforeRelease();
|
|
323
323
|
t.is('rollbackOnce' in gitClient, false);
|
|
324
324
|
});
|
|
325
|
+
|
|
326
|
+
test.serial('should return latest tag from default branch (not parent commit)', async t => {
|
|
327
|
+
sh.exec('git init');
|
|
328
|
+
|
|
329
|
+
{
|
|
330
|
+
const options = { git: { getLatestTagFromAllRefs: true } };
|
|
331
|
+
const gitClient = factory(Git, { options });
|
|
332
|
+
gitAdd('main', 'file', 'Add file in main');
|
|
333
|
+
const defaultBranchName = await gitClient.getBranchName();
|
|
334
|
+
const developBranchName = 'develop';
|
|
335
|
+
const featureBranchPrefix = 'feature';
|
|
336
|
+
await gitClient.tag({ name: '1.0.0' });
|
|
337
|
+
sh.exec(`git branch ${developBranchName} ${defaultBranchName}`);
|
|
338
|
+
sh.exec(`git checkout -b ${featureBranchPrefix}/first ${developBranchName}`);
|
|
339
|
+
gitAdd('feature/1', 'file', 'Update file in feature branch (1)');
|
|
340
|
+
sh.exec(`git checkout ${developBranchName}`);
|
|
341
|
+
sh.exec(`git merge --no-ff ${featureBranchPrefix}/first`);
|
|
342
|
+
await gitClient.tag({ name: '1.1.0-rc.1' });
|
|
343
|
+
sh.exec(`git checkout ${defaultBranchName}`);
|
|
344
|
+
sh.exec(`git merge --no-ff ${developBranchName}`);
|
|
345
|
+
await gitClient.tag({ name: '1.1.0' });
|
|
346
|
+
sh.exec(`git checkout -b ${featureBranchPrefix}/second ${developBranchName}`);
|
|
347
|
+
gitAdd('feature/2', 'file', 'Update file again, in feature branch (2)');
|
|
348
|
+
sh.exec(`git checkout ${developBranchName}`);
|
|
349
|
+
sh.exec(`git merge --no-ff ${featureBranchPrefix}/second`);
|
|
350
|
+
t.is(await gitClient.getLatestTagName(), '1.1.0');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
{
|
|
354
|
+
const options = { git: { getLatestTagFromAllRefs: false } };
|
|
355
|
+
const gitClient = factory(Git, { options });
|
|
356
|
+
t.is(await gitClient.getLatestTagName(), '1.1.0-rc.1');
|
|
357
|
+
}
|
|
358
|
+
});
|