commit-and-tag-version 12.5.2 → 12.6.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/.github/workflows/ci.yaml +1 -1
- package/.github/workflows/release-please.yml +1 -1
- package/CHANGELOG.md +7 -0
- package/README.md +18 -0
- package/command.js +8 -1
- package/defaults.js +1 -0
- package/lib/configuration.js +6 -2
- package/package.json +2 -2
- package/test/config-files.integration-test.js +24 -0
|
@@ -23,7 +23,7 @@ jobs:
|
|
|
23
23
|
OS: ${{ matrix.os }}
|
|
24
24
|
NODE_VERSION: ${{ matrix.node }}
|
|
25
25
|
steps:
|
|
26
|
-
- uses: actions/checkout@
|
|
26
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
|
|
27
27
|
- run: git fetch --prune --unshallow
|
|
28
28
|
- run: git config --global user.name 'Actions'
|
|
29
29
|
- run: git config --global user.email 'dummy@example.org'
|
|
@@ -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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 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,13 @@
|
|
|
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.6.0](https://github.com/absolute-version/commit-and-tag-version/compare/v12.5.2...v12.6.0) (2025-08-27)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add --config option to allow custom config file path ([#237](https://github.com/absolute-version/commit-and-tag-version/issues/237)) ([3958e68](https://github.com/absolute-version/commit-and-tag-version/commit/3958e688a60df4f1ba46137d1f4147a65817c8d7))
|
|
11
|
+
|
|
5
12
|
## [12.5.2](https://github.com/absolute-version/commit-and-tag-version/compare/v12.5.1...v12.5.2) (2025-07-30)
|
|
6
13
|
|
|
7
14
|
|
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ _Having problems? Want to contribute? Join us on the [node-tooling community Sla
|
|
|
38
38
|
- [Release as a Pre-Release](#release-as-a-pre-release)
|
|
39
39
|
- [Release as a Target Type Imperatively (`npm version`-like)](#release-as-a-target-type-imperatively-npm-version-like)
|
|
40
40
|
- [Prevent Git Hooks](#prevent-git-hooks)
|
|
41
|
+
- [Custom Config Path](#custom-config-path)
|
|
41
42
|
- [Signing Commits and Tags](#signing-commits-and-tags)
|
|
42
43
|
- [Lifecycle Scripts](#lifecycle-scripts)
|
|
43
44
|
- [Skipping Lifecycle Steps](#skipping-lifecycle-steps)
|
|
@@ -312,6 +313,23 @@ npm run release -- --no-verify
|
|
|
312
313
|
commit-and-tag-version --no-verify
|
|
313
314
|
```
|
|
314
315
|
|
|
316
|
+
### Custom Config Path
|
|
317
|
+
|
|
318
|
+
Specify a custom path to the configuration file using the `--config` option
|
|
319
|
+
|
|
320
|
+
```sh
|
|
321
|
+
commit-and-tag-version --config ./path/to/.versionrc.js
|
|
322
|
+
|
|
323
|
+
# or using alias
|
|
324
|
+
commit-and-tag-version -c ./path/to/.versionrc.js
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
All config file formats can be used:
|
|
328
|
+
|
|
329
|
+
```sh
|
|
330
|
+
commit-and-tag-version -c ./path/to/.versionrc[.js|.cjs|.json]
|
|
331
|
+
```
|
|
332
|
+
|
|
315
333
|
### Signing Commits and Tags
|
|
316
334
|
|
|
317
335
|
If you have your GPG key set up, add the `--sign` or `-s` flag to your `commit-and-tag-version` command.
|
package/command.js
CHANGED
|
@@ -132,6 +132,12 @@ const yargs = require('yargs')
|
|
|
132
132
|
default: defaults.npmPublishHint,
|
|
133
133
|
describe: 'Customized publishing hint',
|
|
134
134
|
})
|
|
135
|
+
.option('config', {
|
|
136
|
+
type: 'string',
|
|
137
|
+
default: defaults.config,
|
|
138
|
+
alias: 'c',
|
|
139
|
+
describe: 'Path to a custom configuration file',
|
|
140
|
+
})
|
|
135
141
|
.check((argv) => {
|
|
136
142
|
if (typeof argv.scripts !== 'object' || Array.isArray(argv.scripts)) {
|
|
137
143
|
throw Error('scripts must be an object');
|
|
@@ -150,9 +156,10 @@ const yargs = require('yargs')
|
|
|
150
156
|
)
|
|
151
157
|
.pkgConf('standard-version')
|
|
152
158
|
.pkgConf('commit-and-tag-version')
|
|
153
|
-
.config(getConfiguration())
|
|
154
159
|
.wrap(97);
|
|
155
160
|
|
|
161
|
+
yargs.config(getConfiguration(yargs.argv.config));
|
|
162
|
+
|
|
156
163
|
Object.keys(spec.properties).forEach((propertyKey) => {
|
|
157
164
|
const property = spec.properties[propertyKey];
|
|
158
165
|
yargs.option(propertyKey, {
|
package/defaults.js
CHANGED
package/lib/configuration.js
CHANGED
|
@@ -9,9 +9,13 @@ const CONFIGURATION_FILES = [
|
|
|
9
9
|
'.versionrc.js',
|
|
10
10
|
];
|
|
11
11
|
|
|
12
|
-
module.exports.getConfiguration = function () {
|
|
12
|
+
module.exports.getConfiguration = function (configFile) {
|
|
13
13
|
let config = {};
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
// If the user has provided a configuration file via the `--config` argument, we use that.
|
|
16
|
+
const configurationFiles = configFile ?? CONFIGURATION_FILES;
|
|
17
|
+
|
|
18
|
+
const configPath = findUp.sync(configurationFiles);
|
|
15
19
|
if (!configPath) {
|
|
16
20
|
return config;
|
|
17
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commit-and-tag-version",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.6.0",
|
|
4
4
|
"description": "replacement for `npm version` with automatic CHANGELOG generation",
|
|
5
5
|
"bin": "bin/cli.js",
|
|
6
6
|
"scripts": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"jest": "^29.7.0",
|
|
68
68
|
"jest-serial-runner": "^1.2.1",
|
|
69
69
|
"prettier": "^3.3.3",
|
|
70
|
-
"shelljs": "^0.
|
|
70
|
+
"shelljs": "^0.10.0",
|
|
71
71
|
"strip-ansi": "^6.0.1"
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -86,6 +86,30 @@ describe('config files', function () {
|
|
|
86
86
|
expect(content).toContain(issueUrlFormat);
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
+
it('reads config from custom path', async function () {
|
|
90
|
+
const issueUrlFormat = 'http://www.foo.com/{{id}}';
|
|
91
|
+
const changelog = ({ preset }) => preset.issueUrlFormat;
|
|
92
|
+
mock({ bump: 'minor', changelog });
|
|
93
|
+
fs.mkdirSync('custom-folder');
|
|
94
|
+
fs.writeFileSync(
|
|
95
|
+
'custom-folder/.versionrc.json',
|
|
96
|
+
JSON.stringify({ issueUrlFormat }),
|
|
97
|
+
'utf-8',
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
// Override process.argv to simulate CLI arguments before `exec`.
|
|
101
|
+
// This ensures yargs parses the custom config argument.
|
|
102
|
+
const originalArgv = process.argv;
|
|
103
|
+
process.argv = ['node', 'script.js', '-c', 'custom-folder/.versionrc.json'];
|
|
104
|
+
|
|
105
|
+
await exec(['-c', 'custom-folder/.versionrc.json']);
|
|
106
|
+
const content = fs.readFileSync('CHANGELOG.md', 'utf-8');
|
|
107
|
+
expect(content).toContain(issueUrlFormat);
|
|
108
|
+
|
|
109
|
+
// Restore original process.argv
|
|
110
|
+
process.argv = originalArgv;
|
|
111
|
+
});
|
|
112
|
+
|
|
89
113
|
it('evaluates a config-function from .versionrc.js', async function () {
|
|
90
114
|
const issueUrlFormat = 'http://www.foo.com/{{id}}';
|
|
91
115
|
const src = `module.exports = function() { return ${JSON.stringify({
|