@tomerfi/version-bumper
v4.0.3
Published
A Node.js executable package determining semantic version bumps based on the conventional commits spec.
Downloads
36
Maintainers
Readme
Version Bumper
A Node.js executable package determining semantic version bumps based on the conventional commits spec.
See also version-bumper-action GitHub action.
# old v2 run command
docker run --rm -v $PWD:/usr/share/repo tomerfi/version-bumper:latest --repopath /path/to/git --bumpoverride major
# new v3 run command
docker run --rm -v $PWD:/repo tomerfi/version-bumper:latest --repo /path/to/git --bump major
Usage
The version-bumper tool is executed using npx
or consumed as a standard package.
We also push a container image encapsulating the executable package to docker hub.
Automatic Bumps
The following examples assume:
- 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.
$ npx @tomerfi/version-bumper@latest
$ docker run --rm -v $PWD:/repo tomerfi/version-bumper:latest
$ podman run --privileged --rm -v $PWD:/repo:ro docker.io/tomerfi/version-bumper:latest
For commits with a fix type, the output of the above commands will be:
{"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:
{"current":"2.1.4","bump":"minor","next":"2.2.0","dev":"2.2.1-dev"}
For commits containing the text BREAKING CHANGE in their body, the output of the above commands will be:
{"current":"2.1.4","bump":"major","next":"3.0.0","dev":"3.0.1-dev"}
Manual Bumps
Occasionally, we may want to use this only for bumps; no git repository is required.
$ npx @tomerfi/version-bumper@latest -s 2.1.4 -b patch
$ docker run --rm tomerfi/version-bumper:latest -s 2.1.4 -b patch
{"current":"2.1.4","bump":"patch","next":"2.1.5","dev":"2.1.6-dev"}
$ npx @tomerfi/version-bumper@latest -s 2.1.4 -b minor
$ docker run --rm tomerfi/version-bumper:latest -s 2.1.4 -b minor
{"current":"2.1.4","bump":"minor","next":"2.2.0","dev":"2.2.1-dev"}
$ npx @tomerfi/version-bumper@latest -s 2.1.4 -b major
$ docker run --rm tomerfi/version-bumper:latest -s 2.1.4 -b major
{"current":"2.1.4","bump":"major","next":"3.0.0","dev":"3.0.1-dev"}
ES Module
import { bumper } from '@tomerfi/version-bumper'
// prints { current: '2.1.4', bump: 'patch', next: '2.1.5', dev: '2.1.5-dev' }
bumper({source: "2.1.4", bump: 'patch'}).then(bump => console.log(bump))
// prints { current: '2.1.4', bump: 'minor', next: '2.2.0', dev: '2.2.1-dev' }
bumper({source: "2.1.4", bump: 'minor'}).then(bump => console.log(bump))
// prints { current: '2.1.4', bump: 'major', next: '3.0.0', dev: '3.0.1-alpha1' }
bumper({source: "2.1.4", bump: 'minor', label: '-alpha1'}).then(bump => console.log(bump))
Contributors
Contributing guidelines are here.