commit-and-tag-version 9.6.0 → 10.1.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 +2 -1
- package/CHANGELOG.md +36 -0
- package/README.md +33 -18
- package/lib/checkpoint.js +1 -1
- package/lib/lifecycles/changelog.js +1 -1
- package/lib/updaters/index.js +18 -10
- package/lib/updaters/types/gradle.js +16 -0
- package/package.json +10 -10
- package/test/core.spec.js +15 -0
- package/test/mocks/build-6.3.1.gradle.kts +14 -0
- package/test/mocks/build-6.4.0.gradle.kts +14 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
on:
|
|
2
|
+
workflow_dispatch:
|
|
2
3
|
push:
|
|
3
4
|
branches:
|
|
4
5
|
- master
|
|
@@ -20,7 +21,7 @@ jobs:
|
|
|
20
21
|
if: ${{ steps.release.outputs.release_created }}
|
|
21
22
|
- uses: actions/setup-node@v3
|
|
22
23
|
with:
|
|
23
|
-
node-version:
|
|
24
|
+
node-version: 16
|
|
24
25
|
registry-url: 'https://registry.npmjs.org'
|
|
25
26
|
if: ${{ steps.release.outputs.release_created }}
|
|
26
27
|
- run: npm ci
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,42 @@
|
|
|
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
|
+
## [10.1.0](https://github.com/absolute-version/commit-and-tag-version/compare/v10.0.1...v10.1.0) (2022-08-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **options:** Expose parser and writer options from `conventional-commits-parser` and `conventional-commits-writer` ([185a461](https://github.com/absolute-version/commit-and-tag-version/commit/185a461acc1caf947bf78dd2185f4687afad66fc))
|
|
11
|
+
* **updater:** add Gradle support ([0cf439f](https://github.com/absolute-version/commit-and-tag-version/commit/0cf439fe4047ffa10d21196714c25517535b6302))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* use correct param for dryRun check ([300b907](https://github.com/absolute-version/commit-and-tag-version/commit/300b90777c5c8c9cca15f69122af1d41981ca47d))
|
|
17
|
+
|
|
18
|
+
### [10.0.1](https://github.com/absolute-version/commit-and-tag-version/compare/v10.0.0...v10.0.1) (2022-05-28)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* No longer warn inappropriately when a custom updater is provided as an object ([5eb8886](https://github.com/absolute-version/commit-and-tag-version/commit/5eb8886a56c6b14c13544192edb3d0e18f91184a))
|
|
24
|
+
|
|
25
|
+
## [10.0.0](https://github.com/absolute-version/commit-and-tag-version/compare/v9.6.0...v10.0.0) (2022-05-25)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### ⚠ BREAKING CHANGES
|
|
29
|
+
|
|
30
|
+
* Drop support for node 10 and 12, support node 16 and 18
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* **deps:** update dependency yargs to v17 ([d190c51](https://github.com/absolute-version/commit-and-tag-version/commit/d190c51507026adefe640cdd75f0a643afd81b87))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Build System
|
|
38
|
+
|
|
39
|
+
* Drop support for node 10 and 12, support node 16 and 18 ([0f75115](https://github.com/absolute-version/commit-and-tag-version/commit/0f751158c2df9cbf7a2c16bef55a5de084f0d17d))
|
|
40
|
+
|
|
5
41
|
## [9.6.0](https://github.com/absolute-version/commit-and-tag-version/compare/v9.5.0...v9.6.0) (2022-05-25)
|
|
6
42
|
|
|
7
43
|
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Commit and Tag Version
|
|
2
2
|
|
|
3
3
|
> **`commit-and-tag-version` is a fork of `standard-version`**. Because of maintainer availability, `standard-version` was [deprecated on 15th May 2022](https://github.com/conventional-changelog/standard-version/pull/907). The previous maintainer recommends [release-please](https://github.com/googleapis/release-please) as an alternative for those who are using GitHub actions. This fork exists for those who can't switch to `release-please`, or who would like to continue using `standard-version`.
|
|
4
4
|
|
|
5
|
-
> **`Why was it renamed commit-and-tag-version?`**. I
|
|
5
|
+
> **`Why was it renamed commit-and-tag-version?`**. I didn't want to scope the package or name it `standard-version-fork`, and it was a good opportunity to make the purpose of the tool clearer. I also wanted to distinguish it from the other tool in this organisation, [`absolute-version`](https://github.com/absolute-version/absolute-version-js), which just prints version information for pre-releases. To migrate, you can drop in `commit-and-tag-version` in place of `standard-version`. There are no changes in 9.5.0, other than to add the package.json config key `commit-and-tag-version` (the previous configuration key `standard-version` will still work).
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
A utility for versioning using [semver](https://semver.org/) and CHANGELOG generation powered by [Conventional Commits](https://conventionalcommits.org).
|
|
@@ -43,6 +43,15 @@ By default, `commit-and-tag-version` assumes you're working in a NodeJS based pr
|
|
|
43
43
|
|
|
44
44
|
That said, if you find your self asking [How can I use commit-and-tag-version for additional metadata files, languages or version files?](#can-i-use-commit-and-tag-version-for-additional-metadata-files-languages-or-version-files) – these configuration options will help!
|
|
45
45
|
|
|
46
|
+
### Gradle Support (Java/Kotlin)
|
|
47
|
+
|
|
48
|
+
If you are using Gradle, then just point to your `build.gradle` file (or `build.gradle.kts` if using Kotlin DSL).
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
commit-and-tag-version --packageFiles build.gradle --bumpFiles build.gradle
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
46
55
|
## Installing `commit-and-tag-version`
|
|
47
56
|
|
|
48
57
|
### As a local `npm run` script
|
|
@@ -99,8 +108,6 @@ You can configure `commit-and-tag-version` either by:
|
|
|
99
108
|
|
|
100
109
|
- If you are using a `.versionrc.js` your default export must be a configuration object, or a function returning a configuration object.
|
|
101
110
|
|
|
102
|
-
|
|
103
|
-
|
|
104
111
|
Any of the command line parameters accepted by `commit-and-tag-version` can instead
|
|
105
112
|
be provided via configuration. Please refer to the [conventional-changelog-config-spec](https://github.com/conventional-changelog/conventional-changelog-config-spec/) for details on available configuration options.
|
|
106
113
|
|
|
@@ -108,17 +115,9 @@ be provided via configuration. Please refer to the [conventional-changelog-confi
|
|
|
108
115
|
|
|
109
116
|
By default, `commit-and-tag-version` uses the [conventionalcommits preset](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits).
|
|
110
117
|
|
|
111
|
-
This preset
|
|
112
|
-
|
|
113
|
-
- Adheres closely to the [conventionalcommits.org](https://www.conventionalcommits.org)
|
|
114
|
-
specification.
|
|
115
|
-
- Is highly configurable, following the configuration specification
|
|
116
|
-
[maintained here](https://github.com/conventional-changelog/conventional-changelog-config-spec).
|
|
117
|
-
- _We've documented these config settings as a recommendation to other tooling makers._
|
|
118
|
-
|
|
119
|
-
There are a variety of dials and knobs you can turn related to CHANGELOG generation.
|
|
118
|
+
This preset adheres closely to the [conventionalcommits.org](https://www.conventionalcommits.org) specification.
|
|
120
119
|
|
|
121
|
-
|
|
120
|
+
Suppose you're using GitLab, rather than GitHub, you might modify the following variables:
|
|
122
121
|
|
|
123
122
|
- `commitUrlFormat`: the URL format of commit SHAs detected in commit messages.
|
|
124
123
|
- `compareUrlFormat`: the URL format used to compare two tags.
|
|
@@ -126,6 +125,20 @@ As an example, suppose you're using GitLab, rather than GitHub, you might modify
|
|
|
126
125
|
|
|
127
126
|
Making these URLs match GitLab's format, rather than GitHub's.
|
|
128
127
|
|
|
128
|
+
### Deeper customization
|
|
129
|
+
|
|
130
|
+
You can override both [parser](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser) and [writer](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer) options (they will be merged into the preset we just mentioned). As an example, to list commits in the order that they were committed:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"commit-and-tag-version": {
|
|
135
|
+
"writerOpts": {
|
|
136
|
+
"commitsSort": false
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
129
142
|
## CLI Usage
|
|
130
143
|
|
|
131
144
|
> **NOTE:** To pass nested configurations to the CLI without defining them in the `package.json` use dot notation as the parameters `e.g. --skip.changelog`.
|
|
@@ -326,7 +339,9 @@ If you do not want to have any tag prefix you can use the `-t` flag and provide
|
|
|
326
339
|
|
|
327
340
|
### Tag replacement
|
|
328
341
|
|
|
329
|
-
If you've already run `
|
|
342
|
+
If you've already run `commit-and-tag-version` when creating your release, you may want to alter the release content and changelog without bumping
|
|
343
|
+
the version, by using `commit-and-tag-version --skip.bump`. By default, tagging with an already existing tag make `git` fails.
|
|
344
|
+
You can add the `--tag-force` flag to make use of `-f` option when calling `git tag`, then the existing version tag will be replaced.
|
|
330
345
|
|
|
331
346
|
### CLI Help
|
|
332
347
|
|
|
@@ -340,11 +355,11 @@ commit-and-tag-version --help
|
|
|
340
355
|
## Code Usage
|
|
341
356
|
|
|
342
357
|
```js
|
|
343
|
-
const
|
|
358
|
+
const commitAndTagVersion = require("commit-and-tag-version");
|
|
344
359
|
|
|
345
360
|
// Options are the same as command line, except camelCase
|
|
346
|
-
//
|
|
347
|
-
|
|
361
|
+
// commitAndTagVersion returns a Promise
|
|
362
|
+
commitAndTagVersion({
|
|
348
363
|
noVerify: true,
|
|
349
364
|
infile: "docs/CHANGELOG.md",
|
|
350
365
|
silent: true,
|
package/lib/checkpoint.js
CHANGED
|
@@ -3,7 +3,7 @@ const figures = require('figures')
|
|
|
3
3
|
const util = require('util')
|
|
4
4
|
|
|
5
5
|
module.exports = function (argv, msg, args, figure) {
|
|
6
|
-
const defaultFigure =
|
|
6
|
+
const defaultFigure = argv.dryRun ? chalk.yellow(figures.tick) : chalk.green(figures.tick)
|
|
7
7
|
if (!argv.silent) {
|
|
8
8
|
console.info((figure || defaultFigure) + ' ' + util.format.apply(util, [msg].concat(args.map(function (arg) {
|
|
9
9
|
return chalk.bold(arg)
|
|
@@ -35,7 +35,7 @@ function outputChangelog (args, newVersion) {
|
|
|
35
35
|
debug: args.verbose && console.info.bind(console, 'conventional-changelog'),
|
|
36
36
|
preset: presetLoader(args),
|
|
37
37
|
tagPrefix: args.tagPrefix
|
|
38
|
-
}, context, { merges: null, path: args.path })
|
|
38
|
+
}, context, { merges: null, path: args.path }, args.parserOpts, args.writerOpts)
|
|
39
39
|
.on('error', function (err) {
|
|
40
40
|
return reject(err)
|
|
41
41
|
})
|
package/lib/updaters/index.js
CHANGED
|
@@ -2,7 +2,8 @@ const path = require('path')
|
|
|
2
2
|
const JSON_BUMP_FILES = require('../../defaults').bumpFiles
|
|
3
3
|
const updatersByType = {
|
|
4
4
|
json: require('./types/json'),
|
|
5
|
-
'plain-text': require('./types/plain-text')
|
|
5
|
+
'plain-text': require('./types/plain-text'),
|
|
6
|
+
gradle: require('./types/gradle')
|
|
6
7
|
}
|
|
7
8
|
const PLAIN_TEXT_BUMP_FILES = ['VERSION.txt', 'version.txt']
|
|
8
9
|
|
|
@@ -21,6 +22,9 @@ function getUpdaterByFilename (filename) {
|
|
|
21
22
|
if (PLAIN_TEXT_BUMP_FILES.includes(filename)) {
|
|
22
23
|
return getUpdaterByType('plain-text')
|
|
23
24
|
}
|
|
25
|
+
if (/build.gradle/.test(filename)) {
|
|
26
|
+
return getUpdaterByType('gradle')
|
|
27
|
+
}
|
|
24
28
|
throw Error(
|
|
25
29
|
`Unsupported file (${filename}) provided for bumping.\n Please specify the updater \`type\` or use a custom \`updater\`.`
|
|
26
30
|
)
|
|
@@ -44,6 +48,7 @@ function getCustomUpdaterFromPath (updater) {
|
|
|
44
48
|
*/
|
|
45
49
|
function isValidUpdater (obj) {
|
|
46
50
|
return (
|
|
51
|
+
obj &&
|
|
47
52
|
typeof obj.readVersion === 'function' &&
|
|
48
53
|
typeof obj.writeVersion === 'function'
|
|
49
54
|
)
|
|
@@ -63,16 +68,19 @@ module.exports.resolveUpdaterObjectFromArgument = function (arg) {
|
|
|
63
68
|
filename: arg
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
|
|
72
|
+
if (!isValidUpdater(updater.updater)) {
|
|
73
|
+
try {
|
|
74
|
+
if (typeof updater.updater === 'string') {
|
|
75
|
+
updater.updater = getCustomUpdaterFromPath(updater.updater)
|
|
76
|
+
} else if (updater.type) {
|
|
77
|
+
updater.updater = getUpdaterByType(updater.type)
|
|
78
|
+
} else {
|
|
79
|
+
updater.updater = getUpdaterByFilename(updater.filename)
|
|
80
|
+
}
|
|
81
|
+
} catch (err) {
|
|
82
|
+
if (err.code !== 'ENOENT') console.warn(`Unable to obtain updater for: ${JSON.stringify(arg)}\n - Error: ${err.message}\n - Skipping...`)
|
|
73
83
|
}
|
|
74
|
-
} catch (err) {
|
|
75
|
-
if (err.code !== 'ENOENT') console.warn(`Unable to obtain updater for: ${JSON.stringify(arg)}\n - Error: ${err.message}\n - Skipping...`)
|
|
76
84
|
}
|
|
77
85
|
/**
|
|
78
86
|
* We weren't able to resolve an updater for the argument.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const versionRegex = /^version\s+=\s+['"]([\d.]+)['"]/m
|
|
2
|
+
|
|
3
|
+
module.exports.readVersion = function (contents) {
|
|
4
|
+
const matches = versionRegex.exec(contents)
|
|
5
|
+
if (matches === null) {
|
|
6
|
+
throw new Error('Failed to read the version field in your gradle file - is it present?')
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return matches[1]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module.exports.writeVersion = function (contents, version) {
|
|
13
|
+
return contents.replace(versionRegex, () => {
|
|
14
|
+
return `version = "${version}"`
|
|
15
|
+
})
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commit-and-tag-version",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "replacement for `npm version` with automatic CHANGELOG generation",
|
|
5
5
|
"bin": "bin/cli.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"repository": "absolute-version/commit-and-tag-version",
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": ">=
|
|
21
|
+
"node": ">=14"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
24
|
"conventional-changelog",
|
|
@@ -50,17 +50,17 @@
|
|
|
50
50
|
"git-semver-tags": "^4.0.0",
|
|
51
51
|
"semver": "^7.1.1",
|
|
52
52
|
"stringify-package": "^1.0.1",
|
|
53
|
-
"yargs": "^
|
|
53
|
+
"yargs": "^17.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"chai": "^4.2.0",
|
|
57
|
-
"eslint": "^
|
|
58
|
-
"eslint-config-standard": "^
|
|
59
|
-
"eslint-plugin-import": "^2.
|
|
60
|
-
"eslint-plugin-
|
|
61
|
-
"eslint-plugin-promise": "^
|
|
62
|
-
"mocha": "^
|
|
63
|
-
"mock-fs": "^
|
|
57
|
+
"eslint": "^8.16.0",
|
|
58
|
+
"eslint-config-standard": "^17.0.0",
|
|
59
|
+
"eslint-plugin-import": "^2.26.0",
|
|
60
|
+
"eslint-plugin-n": "^15.2.0",
|
|
61
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
62
|
+
"mocha": "^10.0.0",
|
|
63
|
+
"mock-fs": "^5.0.0",
|
|
64
64
|
"mockery": "^2.1.0",
|
|
65
65
|
"nyc": "^15.1.0",
|
|
66
66
|
"shelljs": "^0.8.4",
|
package/test/core.spec.js
CHANGED
|
@@ -678,6 +678,21 @@ describe('commit-and-tag-version', function () {
|
|
|
678
678
|
).version.should.equal('6.4.0')
|
|
679
679
|
})
|
|
680
680
|
|
|
681
|
+
it('bumps version in Gradle `build.gradle.kts` file', async function () {
|
|
682
|
+
const expected = fs.readFileSync('./test/mocks/build-6.4.0.gradle.kts', 'utf-8')
|
|
683
|
+
mock({
|
|
684
|
+
bump: 'minor',
|
|
685
|
+
fs: {
|
|
686
|
+
'build.gradle.kts': fs.readFileSync('./test/mocks/build-6.3.1.gradle.kts')
|
|
687
|
+
}
|
|
688
|
+
})
|
|
689
|
+
await exec({
|
|
690
|
+
packageFiles: [{ filename: 'build.gradle.kts', type: 'gradle' }],
|
|
691
|
+
bumpFiles: [{ filename: 'build.gradle.kts', type: 'gradle' }]
|
|
692
|
+
})
|
|
693
|
+
fs.readFileSync('build.gradle.kts', 'utf-8').should.equal(expected)
|
|
694
|
+
})
|
|
695
|
+
|
|
681
696
|
it('bumps version # in npm-shrinkwrap.json', async function () {
|
|
682
697
|
mock({
|
|
683
698
|
bump: 'minor',
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
plugins {
|
|
2
|
+
id("org.springframework.boot") version "2.4.6"
|
|
3
|
+
kotlin("jvm") version "1.4.31"
|
|
4
|
+
kotlin("plugin.spring") version "1.4.31"
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
version = "6.3.1"
|
|
8
|
+
java.sourceCompatibility = JavaVersion.VERSION_1_8
|
|
9
|
+
|
|
10
|
+
repositories {
|
|
11
|
+
mavenLocal()
|
|
12
|
+
mavenCentral()
|
|
13
|
+
}
|
|
14
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
plugins {
|
|
2
|
+
id("org.springframework.boot") version "2.4.6"
|
|
3
|
+
kotlin("jvm") version "1.4.31"
|
|
4
|
+
kotlin("plugin.spring") version "1.4.31"
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
version = "6.4.0"
|
|
8
|
+
java.sourceCompatibility = JavaVersion.VERSION_1_8
|
|
9
|
+
|
|
10
|
+
repositories {
|
|
11
|
+
mavenLocal()
|
|
12
|
+
mavenCentral()
|
|
13
|
+
}
|
|
14
|
+
|