commit-and-tag-version 12.5.0 → 12.5.2
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/.github/workflows/ci.yaml +2 -3
- package/.github/workflows/release-please.yml +1 -1
- package/CHANGELOG.md +14 -0
- package/CONTRIBUTING.md +41 -0
- package/README.md +8 -0
- package/eslint.config.mjs +67 -0
- package/index.js +2 -1
- package/lib/latest-semver-tag.js +16 -1
- package/lib/lifecycles/changelog.js +1 -1
- package/package.json +18 -16
- package/test/git.integration-test.js +8 -0
- package/.eslintrc +0 -49
|
@@ -12,7 +12,6 @@ jobs:
|
|
|
12
12
|
matrix:
|
|
13
13
|
node: [
|
|
14
14
|
18,
|
|
15
|
-
20.4, # Known good version of 20 which ran the previous Mocha and mock-fs based tests. If you go back to re-run those, tests Node 20.4 is the last version mock-fs worked with
|
|
16
15
|
20,
|
|
17
16
|
lts/*
|
|
18
17
|
]
|
|
@@ -24,7 +23,7 @@ jobs:
|
|
|
24
23
|
OS: ${{ matrix.os }}
|
|
25
24
|
NODE_VERSION: ${{ matrix.node }}
|
|
26
25
|
steps:
|
|
27
|
-
- uses: actions/checkout@
|
|
26
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
28
27
|
- run: git fetch --prune --unshallow
|
|
29
28
|
- run: git config --global user.name 'Actions'
|
|
30
29
|
- run: git config --global user.email 'dummy@example.org'
|
|
@@ -35,6 +34,6 @@ jobs:
|
|
|
35
34
|
- run: npm install --engine-strict
|
|
36
35
|
- run: npm test
|
|
37
36
|
- name: Codecov
|
|
38
|
-
uses: codecov/codecov-action@
|
|
37
|
+
uses: codecov/codecov-action@v5
|
|
39
38
|
with:
|
|
40
39
|
env_vars: OS, NODE_VERSION
|
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
release-type: node
|
|
16
16
|
package-name: commit-and-tag-version
|
|
17
17
|
# The logic below handles the npm publication:
|
|
18
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
19
19
|
# these if statements ensure that a publication only occurs when
|
|
20
20
|
# a new release is created:
|
|
21
21
|
if: ${{ steps.release.outputs.release_created }}
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [12.5.2](https://github.com/absolute-version/commit-and-tag-version/compare/v12.5.1...v12.5.2) (2025-07-30)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* Correct use of fs, so we no longer emit a deprecation warning for `fs.F_OK` ([7fe66bb](https://github.com/absolute-version/commit-and-tag-version/commit/7fe66bb590103a593ecacabeb8effb8716862517)), closes [#240](https://github.com/absolute-version/commit-and-tag-version/issues/240)
|
|
11
|
+
|
|
12
|
+
## [12.5.1](https://github.com/absolute-version/commit-and-tag-version/compare/v12.5.0...v12.5.1) (2025-04-09)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* ignore other prerelease tags when finding latest tag ([#211](https://github.com/absolute-version/commit-and-tag-version/issues/211)) ([#213](https://github.com/absolute-version/commit-and-tag-version/issues/213)) ([1bcdf40](https://github.com/absolute-version/commit-and-tag-version/commit/1bcdf408cac54aff37aa4d5611444f6877aad6f9))
|
|
18
|
+
|
|
5
19
|
## [12.5.0](https://github.com/absolute-version/commit-and-tag-version/compare/v12.4.4...v12.5.0) (2024-10-10)
|
|
6
20
|
|
|
7
21
|
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Contributing to `commit-and-tag-version`
|
|
2
|
+
|
|
3
|
+
Thank you for considering contributing to `commit-and-tag-version`! Your help is greatly appreciated.
|
|
4
|
+
|
|
5
|
+
## How to Get Started
|
|
6
|
+
|
|
7
|
+
1. **Fork** this repository to your GitHub account.
|
|
8
|
+
2. **Clone** the forked repository to your local machine.
|
|
9
|
+
3. **Create** a new branch for your contributions.
|
|
10
|
+
4. **Make** your changes or additions.
|
|
11
|
+
5. **Push** the branch to your forked repository.
|
|
12
|
+
6. **Submit** a pull request and describe the changes made.
|
|
13
|
+
|
|
14
|
+
## Bug Reports
|
|
15
|
+
|
|
16
|
+
If you encounter any bugs, please open an [issue](https://github.com/absolute-version/commit-and-tag-version/issues) and include:
|
|
17
|
+
|
|
18
|
+
- A detailed description of the bug.
|
|
19
|
+
- Steps to reproduce the bug.
|
|
20
|
+
- Expected and actual behavior.
|
|
21
|
+
- Your environment (OS, browser, etc.).
|
|
22
|
+
|
|
23
|
+
## Feature Requests
|
|
24
|
+
|
|
25
|
+
To suggest new features or enhancements, please open an [issue](https://github.com/absolute-version/commit-and-tag-version/issues) with:
|
|
26
|
+
|
|
27
|
+
- A clear and detailed description of the feature.
|
|
28
|
+
- The problem it would solve or the use case it would address.
|
|
29
|
+
- Any implementation suggestions.
|
|
30
|
+
|
|
31
|
+
## Pull Request Guidelines
|
|
32
|
+
|
|
33
|
+
- Ensure your code adheres to the project’s coding standards.
|
|
34
|
+
- Write tests for new features or bug fixes.
|
|
35
|
+
- Update documentation as necessary. If there are user facing changes / new features, please ensure the `Readme.md` is updated
|
|
36
|
+
- Provide a comprehensive description of your changes in the pull request.
|
|
37
|
+
- Do not include `package.lock.json` modifications; only include `package.json`. Maintainers will be responsible to generate it.
|
|
38
|
+
- Do not include multiple features in a single commit/PR
|
|
39
|
+
- Please title the PR with [conventional commits](https://www.conventionalcommits.org/), as PRs are squash merged
|
|
40
|
+
|
|
41
|
+
We look forward to your contributions and value your time and effort!
|
package/README.md
CHANGED
|
@@ -629,6 +629,14 @@ with other package managers for other ecosystems).
|
|
|
629
629
|
|
|
630
630
|
When you are ready to release v1.0.0, add `--release-as 1.0.0` to the options.
|
|
631
631
|
|
|
632
|
+
### Why do my `refactor`, `chore` etc changes not appear in the changelog?
|
|
633
|
+
|
|
634
|
+
By default, the conventional commits preset is used. This means that only `fix`, `feat` and anything marked as a breaking change will appear in the changelog.
|
|
635
|
+
|
|
636
|
+
Conventional commits is meant to make it easy for machines to reason about the user-facing changes,
|
|
637
|
+
and the changelog generation makes it easy for humans to consume this information too.
|
|
638
|
+
Usually, you wouldn't want non-user facing changes like refactor in the changelog.
|
|
639
|
+
|
|
632
640
|
## License
|
|
633
641
|
|
|
634
642
|
ISC
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import js from "@eslint/js";
|
|
3
|
+
import jest from "eslint-plugin-jest";
|
|
4
|
+
import eslintConfigPrettier from "eslint-config-prettier";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @type {import("eslint").Linter.Config}
|
|
8
|
+
*/
|
|
9
|
+
export default [
|
|
10
|
+
{
|
|
11
|
+
"ignores": [".git/", ".github/", ".husky/", ".scannerwork/", ".vscode/", "coverage/", "node_modules/"],
|
|
12
|
+
"name": "Files to ignore"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
...eslintConfigPrettier,
|
|
16
|
+
"name": "Prettier"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
...js.configs.recommended,
|
|
20
|
+
"files": ["**/*.{js,cjs,mjs}"],
|
|
21
|
+
"languageOptions": {
|
|
22
|
+
"ecmaVersion": 2023
|
|
23
|
+
},
|
|
24
|
+
"name": "JavaScript files",
|
|
25
|
+
"rules": {
|
|
26
|
+
...js.configs.recommended.rules,
|
|
27
|
+
"no-var": "error",
|
|
28
|
+
"no-unused-vars": [
|
|
29
|
+
"error",
|
|
30
|
+
{
|
|
31
|
+
"argsIgnorePattern": "_.*"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"files": ["**/*.mjs"],
|
|
38
|
+
"languageOptions": {
|
|
39
|
+
"sourceType": "module"
|
|
40
|
+
},
|
|
41
|
+
"name": "JavaScript modules"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"files": ["**/*.{js,cjs,mjs}"],
|
|
45
|
+
"languageOptions": {
|
|
46
|
+
"globals": {
|
|
47
|
+
...globals.node
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"name": "Node.js files"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
...jest.configs["flat/recommended"],
|
|
54
|
+
"files": ["test/**/*{spec,test}.{js,cjs,mjs}", "test/mocks/jest-mocks.js"],
|
|
55
|
+
"languageOptions": {
|
|
56
|
+
"globals": {
|
|
57
|
+
...globals.jest
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"name": "Test files",
|
|
61
|
+
"rules": {
|
|
62
|
+
...jest.configs["flat/recommended"].rules,
|
|
63
|
+
"jest/prefer-expect-assertions": "off",
|
|
64
|
+
"jest/expect-expect": "off"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
];
|
package/index.js
CHANGED
|
@@ -69,6 +69,7 @@ module.exports = async function standardVersion(argv) {
|
|
|
69
69
|
: false,
|
|
70
70
|
};
|
|
71
71
|
break;
|
|
72
|
+
// eslint-disable-next-line no-unused-vars
|
|
72
73
|
} catch (err) {
|
|
73
74
|
/* This probably shouldn't be empty? */
|
|
74
75
|
}
|
|
@@ -78,7 +79,7 @@ module.exports = async function standardVersion(argv) {
|
|
|
78
79
|
if (pkg && pkg.version) {
|
|
79
80
|
version = pkg.version;
|
|
80
81
|
} else if (args.gitTagFallback) {
|
|
81
|
-
version = await latestSemverTag(args
|
|
82
|
+
version = await latestSemverTag(args);
|
|
82
83
|
} else {
|
|
83
84
|
throw new Error('no package file found');
|
|
84
85
|
}
|
package/lib/latest-semver-tag.js
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
const gitSemverTags = require('git-semver-tags');
|
|
2
2
|
const semver = require('semver');
|
|
3
3
|
|
|
4
|
-
module.exports = function (tagPrefix
|
|
4
|
+
module.exports = function ({ tagPrefix, prerelease }) {
|
|
5
5
|
return new Promise((resolve, reject) => {
|
|
6
6
|
gitSemverTags({ tagPrefix }, function (err, tags) {
|
|
7
7
|
if (err) return reject(err);
|
|
8
8
|
else if (!tags.length) return resolve('1.0.0');
|
|
9
9
|
// Respect tagPrefix
|
|
10
10
|
tags = tags.map((tag) => tag.replace(new RegExp('^' + tagPrefix), ''));
|
|
11
|
+
if (prerelease) {
|
|
12
|
+
// ignore any other prelease tags
|
|
13
|
+
tags = tags.filter((tag) => {
|
|
14
|
+
if (!semver.valid(tag)) return false;
|
|
15
|
+
if (!semver.prerelease(tag)) {
|
|
16
|
+
// include all non-prerelease versions
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
// check if the name of the prerelease matches the one we are looking for
|
|
20
|
+
if (semver.prerelease(tag)[0] === prerelease) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
11
26
|
// ensure that the largest semver tag is at the head.
|
|
12
27
|
tags = tags.map((tag) => {
|
|
13
28
|
return semver.clean(tag);
|
|
@@ -102,7 +102,7 @@ function outputChangelog(args, newVersion) {
|
|
|
102
102
|
|
|
103
103
|
function createIfMissing(args) {
|
|
104
104
|
try {
|
|
105
|
-
fs.accessSync(args.infile, fs.F_OK);
|
|
105
|
+
fs.accessSync(args.infile, fs.constants.F_OK);
|
|
106
106
|
} catch (err) {
|
|
107
107
|
if (err.code === 'ENOENT') {
|
|
108
108
|
checkpoint(args, 'created %s', [args.infile]);
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commit-and-tag-version",
|
|
3
|
-
"version": "12.5.
|
|
3
|
+
"version": "12.5.2",
|
|
4
4
|
"description": "replacement for `npm version` with automatic CHANGELOG generation",
|
|
5
5
|
"bin": "bin/cli.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
7
|
+
"lint": "eslint .",
|
|
8
|
+
"lint:fix": "npm run lint -- --fix",
|
|
9
|
+
"posttest": "npm run lint && npm run format:check",
|
|
9
10
|
"format:base": "prettier \"./**/*.{ts,js}\"",
|
|
10
11
|
"format:fix": "npm run format:base -- --write",
|
|
11
12
|
"format:check": "npm run format:base -- --check",
|
|
@@ -43,29 +44,30 @@
|
|
|
43
44
|
"conventional-changelog-config-spec": "2.1.0",
|
|
44
45
|
"conventional-changelog-conventionalcommits": "6.1.0",
|
|
45
46
|
"conventional-recommended-bump": "7.0.1",
|
|
46
|
-
"detect-indent": "^6.
|
|
47
|
+
"detect-indent": "^6.1.0",
|
|
47
48
|
"detect-newline": "^3.1.0",
|
|
48
49
|
"dotgitignore": "^2.1.0",
|
|
49
|
-
"figures": "^3.
|
|
50
|
+
"figures": "^3.2.0",
|
|
50
51
|
"find-up": "^5.0.0",
|
|
51
|
-
"git-semver-tags": "^5.0.
|
|
52
|
-
"jsdom": "^25.0.
|
|
53
|
-
"semver": "^7.
|
|
52
|
+
"git-semver-tags": "^5.0.1",
|
|
53
|
+
"jsdom": "^25.0.1",
|
|
54
|
+
"semver": "^7.7.2",
|
|
54
55
|
"w3c-xmlserializer": "^5.0.0",
|
|
55
|
-
"yaml": "^2.
|
|
56
|
+
"yaml": "^2.6.0",
|
|
56
57
|
"yargs": "^17.7.2"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
|
-
"eslint": "^
|
|
60
|
+
"@eslint/js": "^9.13.0",
|
|
61
|
+
"eslint": "^9.13.0",
|
|
60
62
|
"eslint-config-prettier": "^9.1.0",
|
|
61
|
-
"eslint-plugin-import": "^2.
|
|
62
|
-
"eslint-plugin-jest": "^
|
|
63
|
-
"eslint-plugin-n": "^
|
|
64
|
-
"eslint-plugin-promise": "^
|
|
63
|
+
"eslint-plugin-import": "^2.31.0",
|
|
64
|
+
"eslint-plugin-jest": "^28.8.3",
|
|
65
|
+
"eslint-plugin-n": "^17.11.1",
|
|
66
|
+
"eslint-plugin-promise": "^7.1.0",
|
|
65
67
|
"jest": "^29.7.0",
|
|
66
68
|
"jest-serial-runner": "^1.2.1",
|
|
67
|
-
"prettier": "3.3.
|
|
69
|
+
"prettier": "^3.3.3",
|
|
68
70
|
"shelljs": "^0.8.5",
|
|
69
|
-
"strip-ansi": "^6.0.
|
|
71
|
+
"strip-ansi": "^6.0.1"
|
|
70
72
|
}
|
|
71
73
|
}
|
|
@@ -272,6 +272,14 @@ describe('git', function () {
|
|
|
272
272
|
const output = shell.exec('git tag');
|
|
273
273
|
expect(output.stdout).toContain('v5.1.0');
|
|
274
274
|
});
|
|
275
|
+
|
|
276
|
+
it('uses only relevant prerelease tags', async function () {
|
|
277
|
+
shell.rm('package.json');
|
|
278
|
+
mock({ bump: 'minor', tags: ['v1.1.0-b.0', 'v1.1.0-a.0', 'v1.0.0-b.0'] });
|
|
279
|
+
await exec('--prerelease a');
|
|
280
|
+
const output = shell.exec('git tag');
|
|
281
|
+
expect(output.stdout).toContain('1.1.0-a.1');
|
|
282
|
+
});
|
|
275
283
|
});
|
|
276
284
|
|
|
277
285
|
describe('Run ... to publish', function () {
|
package/.eslintrc
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"prettier",
|
|
4
|
-
"eslint:recommended"
|
|
5
|
-
],
|
|
6
|
-
"env": {
|
|
7
|
-
"node": true,
|
|
8
|
-
"es6": true
|
|
9
|
-
},
|
|
10
|
-
"overrides": [
|
|
11
|
-
{
|
|
12
|
-
"env": {
|
|
13
|
-
"node": true,
|
|
14
|
-
"es6": true,
|
|
15
|
-
"jest/globals": true
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"test/**"
|
|
19
|
-
],
|
|
20
|
-
"plugins": [
|
|
21
|
-
"jest"
|
|
22
|
-
],
|
|
23
|
-
"extends": [
|
|
24
|
-
"prettier",
|
|
25
|
-
"eslint:recommended",
|
|
26
|
-
"plugin:jest/recommended"
|
|
27
|
-
],
|
|
28
|
-
"rules": {
|
|
29
|
-
"jest/prefer-expect-assertions": "off",
|
|
30
|
-
"jest/expect-expect": "off"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"parserOptions": {
|
|
35
|
-
"ecmaVersion": 2023
|
|
36
|
-
},
|
|
37
|
-
"plugins": [
|
|
38
|
-
"jest"
|
|
39
|
-
],
|
|
40
|
-
"rules": {
|
|
41
|
-
"no-var": "error",
|
|
42
|
-
"no-unused-vars": [
|
|
43
|
-
"error",
|
|
44
|
-
{
|
|
45
|
-
"argsIgnorePattern": "_.*"
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
}
|