diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 2064eca..304cecb 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
node: ['20', 'latest']
- os: [ubuntu-latest, macos-latest]
+ os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
name: "Test project { os: ${{ matrix.os }}, node: ${{ matrix.node }} }"
steps:
diff --git a/README.md b/README.md
index f3fb923..2d1a503 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# Version Bumper
[![docker-version-badge]][docker-image] [![npm-version-badge]][npm-package]
-A Node.js executable package for determining [semantic version][semver-spec] bumps based on
-[conventional commits][conventional-commits].
+A Node.js executable package determining [semantic version][semver-spec] bumps based on the
+[conventional commits spec][conventional-commits].
> See also [version-bumper-action][version-bumper-action] _GitHub_ action.
@@ -15,21 +15,18 @@ A Node.js executable package for determining [semantic version][semver-spec] bum
The output was changed from a space-delimited text to a JSON object:
- old
2.1.5 2.1.6-dev
-- New
{"original":"2.1.4","bump":"patch","next":"2.1.5","dev":"2.1.6-dev"}
+- new
{"current":"2.1.4","bump":"patch","next":"2.1.5","dev":"2.1.6-dev"}
-Option flags changes were modified:
+Changes in the option flags:
- --changelog was removed.
- - --outputtype was removed.
- - --repopath was changed to --repo.
- repopath will still work, but might be removed in the future.
-
- - --bumpoverride was changed to --bump.
- bumpoverride will still work, but might be removed in the future.
+ - --outputtype was removed.
+ - --repopath was changed to --repo (repopath will eventually be removed).
+ - --bumpoverride was changed to --bump (bumpoverride will eventually be removed).
@@ -37,14 +34,14 @@ For more info, run the tool with the -h flag (--help).
-Container image mount target was changed:
+Changes in the container image mount target:
- from /usr/share/repo
- to /repo
-Output to a file is no longer supported, use pipes in needed.
+Output to a file is no longer supported, use pipes if needed.
Changelog file creation is no longer supported.
@@ -60,9 +57,9 @@ We also push a container image encapsulating the executable package to [docker h
### Automatic Bumps
The following examples assume:
-The current working directory is a _git_ repository.
-Latest semver tag is _2.1.4_.
-Commit messages are based on the [conventional commits spec][conventional-commits].
+ - The current working directory is a _git_ repository.
+ - The latest semver tag is _2.1.4_.
+ - Commit messages are based on the [conventional commits spec][conventional-commits].
```shell
$ npx version-bumper
@@ -83,19 +80,19 @@ $ podman run --privileged --rm -v $PWD:/repo:ro docker.io/tomerfi/version-bumper
For commits with a _fix_ type, the output of the above commands will be:
```json
-{"original":"2.1.4","bump":"patch","next":"2.1.5","dev":"2.1.6-dev"}
+{"current":"2.1.4","bump":"patch","next":"2.1.5","dev":"2.1.6-dev"}
```
For commits with a _feat_ type, the output of the above commands will be:
```json
-{"original":"2.1.4","bump":"minor","next":"2.2.0","dev":"2.2.1-dev"}
+{"current":"2.1.4","bump":"minor","next":"2.2.0","dev":"2.2.1-dev"}
```
For commits containing the text _BREAKING CHANGE_ in the message body, the output of the above commands will be:
```json
-{"original":"2.1.4","bump":"major","next":"3.0.0","dev":"3.0.1-dev"}
+{"current":"2.1.4","bump":"major","next":"3.0.0","dev":"3.0.1-dev"}
```
### Manual Bumps
@@ -107,7 +104,7 @@ $ npx version-bumper -s 2.1.4 -b patch
$ docker run --rm tomerfi/version-bumper:latest -s 2.1.4 -b patch
-{"original":"2.1.4","bump":"patch","next":"2.1.5","dev":"2.1.6-dev"}
+{"current":"2.1.4","bump":"patch","next":"2.1.5","dev":"2.1.6-dev"}
```
```shell
@@ -115,7 +112,7 @@ $ npx version-bumper -s 2.1.4 -b minor
$ docker run --rm tomerfi/version-bumper:latest -s 2.1.4 -b minor
-{"original":"2.1.4","bump":"minor","next":"2.2.0","dev":"2.2.1-dev"}
+{"current":"2.1.4","bump":"minor","next":"2.2.0","dev":"2.2.1-dev"}
```
```shell
@@ -123,7 +120,7 @@ $ npx version-bumper -s 2.1.4 -b major
$ docker run --rm tomerfi/version-bumper:latest -s 2.1.4 -b major
-{"original":"2.1.4","bump":"major","next":"3.0.0","dev":"3.0.1-dev"}
+{"current":"2.1.4","bump":"major","next":"3.0.0","dev":"3.0.1-dev"}
```
## Contributors [![all-contributors-badge]][all-contributors]
diff --git a/package.json b/package.json
index fd8705b..696d459 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "version-bumper",
"version": "2.1.2",
- "description": "A Node.js executable package for determining semantic version bumps based on conventional commits",
+ "description": "A Node.js executable package determining semantic version bumps based on the conventional commits spec.",
"homepage": "https://github.com/TomerFi/version-bumper#readme",
"license": "ISC",
"author": {
diff --git a/src/bumper.js b/src/bumper.js
index a3888a2..e60aa23 100644
--- a/src/bumper.js
+++ b/src/bumper.js
@@ -14,7 +14,7 @@ const bumpTypes = ['major', 'minor', 'patch']
* or bump a target semver based on the options passed. The option fields are documented in index.js.
*
* @param {{source: string, path: string, bump: string, label: string, preset: string}} opts options to configure bumper
- * @returns {Promise<{original: string, bump: string, next: string, dev: string}>}
+ * @returns {Promise<{current: string, bump: string, next: string, dev: string}>}
*/
async function bumper(opts) {
// options verification
@@ -38,32 +38,32 @@ async function bumper(opts) {
throw new Error(`development iteration label ${opts.label} breaks semver`)
}
- let next = '1.0.0' // default when no original
+ let next = '1.0.0' // default when no current
let bump = 'none' // default when no bump is performed
- let original = opts.source === 'git' // if source is 'git' fetch latest semver tag from git
+ let current = opts.source === 'git' // if source is 'git' fetch latest semver tag from git
? (await semverTags({cwd: opts.path, skipUnstable: true}))[0] || 'none' // none is default when no tags
: opts?.source
- if ('none' !== original) {
- let cleanOrig = semver.clean(original) // for robustness, we work with the clean version internally
- if (!semver.valid(cleanOrig)) {
- throw new Error(`${original} is not a valid semver`)
+ if ('none' !== current) {
+ let cleanCurrent = semver.clean(current) // for robustness, we work with the clean version internally
+ if (!semver.valid(cleanCurrent)) {
+ throw new Error(`${current} is not a valid semver`)
}
bump = bumpTypes.includes(opts.bump) // if not known manual bump type, use auto type based on commits
? opts.bump
: (await recBump({preset: opts.preset, cwd: opts.path})).releaseType
- next = original.startsWith('v') // patch for versions that starts with v
- ? `v${semver.inc(cleanOrig, bump)}`
- : semver.inc(cleanOrig, bump)
+ next = current.startsWith('v') // patch for versions that starts with v
+ ? `v${semver.inc(cleanCurrent, bump)}`
+ : semver.inc(cleanCurrent, bump)
}
// concatenate development iteration label
- let dev = original.startsWith('v') // patch for versions that starts with v
+ let dev = current.startsWith('v') // patch for versions that starts with v
? `v${semver.inc(next, 'patch')}${opts.label}`
: `${semver.inc(next, 'patch')}${opts.label}`
- return {original, bump, next, dev}
+ return {current, bump, next, dev}
}
diff --git a/src/cli.js b/src/cli.js
index 38d68b3..8bce5dd 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -40,7 +40,7 @@ function help() {
version-bumper path/to/git/repo
Output Example
- { original: '2.1.4', bump: 'patch', next: '2.1.5', dev: '2.1.5-dev' }
+ { current: '2.1.4', bump: 'patch', next: '2.1.5', dev: '2.1.5-dev' }
Options
-s, --source Source for the bump, any semver string or 'git' to fetch from tags. Defaults to 'git'.
diff --git a/src/index.js b/src/index.js
index 3870058..14fee0d 100644
--- a/src/index.js
+++ b/src/index.js
@@ -6,7 +6,7 @@
* @param {string} bump Target bump, 'major' | 'minor' | 'patch' | 'auto'. Defaults to 'auto' which can only be used with a 'git' source.
* @param {string} label Development iteration build label. Defaults to '-dev'.
* @param {string} preset Conventional preset to use. Defaults to 'angular'.
- * @returns {Promise<{original: string, bump: string, next: string, dev: string}>}
+ * @returns {Promise<{current: string, bump: string, next: string, dev: string}>}
*/
module.exports = async function (source = 'git', path = './', bump = 'auto', label = '-dev', preset = 'angular') {
return require('./bumper')({source, path, bump, label, preset})
diff --git a/tests/bumper.test.js b/tests/bumper.test.js
index fe8d8b5..56d95dd 100644
--- a/tests/bumper.test.js
+++ b/tests/bumper.test.js
@@ -9,13 +9,13 @@ chai.use(require('chai-as-promised'))
suite('Test manual bumps', () => {
[{
opts: {source: '1.2.3', bump: 'major', label: '-dev'},
- output: {original: '1.2.3', bump: 'major', next: '2.0.0', dev: '2.0.1-dev'}
+ output: {current: '1.2.3', bump: 'major', next: '2.0.0', dev: '2.0.1-dev'}
},{
opts: {source: '1.2.3', bump: 'minor', label: '-alpha1'},
- output: {original: '1.2.3', bump: 'minor', next: '1.3.0', dev: '1.3.1-alpha1'}
+ output: {current: '1.2.3', bump: 'minor', next: '1.3.0', dev: '1.3.1-alpha1'}
},{
opts: {source: 'v1.2.3', bump: 'patch', label: '-beta1'},
- output: {original: 'v1.2.3', bump: 'patch', next: 'v1.2.4', dev: 'v1.2.5-beta1'}
+ output: {current: 'v1.2.3', bump: 'patch', next: 'v1.2.4', dev: 'v1.2.5-beta1'}
}].forEach(t => {
test(`testing with ${JSON.stringify(t.opts)}
expecting output ${JSON.stringify(t.output)}`, async () => {
@@ -72,7 +72,7 @@ suite('Test automatic bumps', () => {
createRepoContent(noTags)
return expect(bumperSut({source: 'git', bump: 'auto', label: '-alpha1', preset: 'angular', path: noTags}))
- .to.eventually.deep.equal({original: 'none', bump: 'none', next: '1.0.0', dev: '1.0.1-alpha1'})
+ .to.eventually.deep.equal({current: 'none', bump: 'none', next: '1.0.0', dev: '1.0.1-alpha1'})
})
test(`testing with a repository with no new commits
@@ -82,7 +82,7 @@ suite('Test automatic bumps', () => {
createRepoContent(noCommits, true)
return expect(bumperSut({source: 'git', bump: 'auto', label: '-dev.0', preset: 'angular', path: noCommits}))
- .to.eventually.deep.equal({original: '1.2.3', bump: 'patch', next: '1.2.4', dev: '1.2.5-dev.0'})
+ .to.eventually.deep.equal({current: '1.2.3', bump: 'patch', next: '1.2.4', dev: '1.2.5-dev.0'})
})
test(`testing with a fix type commit
@@ -98,7 +98,7 @@ suite('Test automatic bumps', () => {
)
return expect(bumperSut({source: 'git', bump: 'auto', label: '-alpha1', preset: 'angular', path: patchBump}))
- .to.eventually.deep.equal({original: '1.2.3', bump: 'patch', next: '1.2.4', dev: '1.2.5-alpha1'})
+ .to.eventually.deep.equal({current: '1.2.3', bump: 'patch', next: '1.2.4', dev: '1.2.5-alpha1'})
})
test(`testing with a feat type commit
@@ -114,7 +114,7 @@ suite('Test automatic bumps', () => {
)
return expect(bumperSut({source: 'git', bump: 'auto', label: '-alpha1', preset: 'angular', path: minorBump}))
- .to.eventually.deep.equal({original: '1.2.3', bump: 'minor', next: '1.3.0', dev: '1.3.1-alpha1'})
+ .to.eventually.deep.equal({current: '1.2.3', bump: 'minor', next: '1.3.0', dev: '1.3.1-alpha1'})
})
test(`testing with a breaking change commit body
@@ -133,7 +133,7 @@ suite('Test automatic bumps', () => {
)
return expect(bumperSut({source: 'git', bump: 'auto', label: '-alpha1', preset: 'angular', path: minorBump}))
- .to.eventually.deep.equal({original: '1.2.3', bump: 'major', next: '2.0.0', dev: '2.0.1-alpha1'})
+ .to.eventually.deep.equal({current: '1.2.3', bump: 'major', next: '2.0.0', dev: '2.0.1-alpha1'})
})
})