Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomerfi/version-bumper
A Node.js executable package determining semantic version bumps based on the conventional commits spec
https://github.com/tomerfi/version-bumper
automation conventional-commits docker nodejs semver
Last synced: 3 months ago
JSON representation
A Node.js executable package determining semantic version bumps based on the conventional commits spec
- Host: GitHub
- URL: https://github.com/tomerfi/version-bumper
- Owner: TomerFi
- License: isc
- Created: 2021-09-12T21:31:17.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-09-09T20:20:18.000Z (4 months ago)
- Last Synced: 2024-09-10T01:10:45.535Z (4 months ago)
- Topics: automation, conventional-commits, docker, nodejs, semver
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@tomerfi/version-bumper
- Size: 509 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Version Bumper
[![docker-version-badge]][docker-image] [![npm-version-badge]][npm-package]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.
Upgrading from version 2 to 3? Click here.
Version 3 introduced breaking changes
-
The output was changed from a space-delimited text to a JSON object:
-
old2.1.5 2.1.6-dev
-
new{"current":"2.1.4","bump":"patch","next":"2.1.5","dev":"2.1.6-dev"}
-
-
Changes in the option flags:
-
--changelog was removed. Creating a changelog file is no longer supported. -
--outputtype was removed. Output to file is no longer supported. -
--preset was removed. Selecting a preset is no longer supported. -
--repopath was changed to --repo (repopath will eventually be removed). -
--bumpoverride was changed to --bump (bumpoverride will eventually be removed).
For more info, run the tool with the -h flag (--help). -
- Changes in the container image mount target:
- from /usr/share/repo
- to /repo
- from /usr/share/repo
```shell
# 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][docker-image].
### 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][conventional-commits].
```shell
$ npx @tomerfi/version-bumper@latest
$ docker run --rm -v $PWD:/repo tomerfi/version-bumper:latest
```
podman users? Click here.
```shell
$ 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:
```json
{"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
{"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:
```json
{"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.
```shell
$ 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"}
```
```shell
$ 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"}
```
```shell
$ 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
```js
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 [![all-contributors-badge]][all-contributors]
Jasper Vaneessen
💻
Oleksandr Andriiako
🚇
Contributing guidelines are [here][contributing_md].
[docker-image]: https://hub.docker.com/r/tomerfi/version-bumper
[npm-package]: https://www.npmjs.com/package/@tomerfi/version-bumper
[conventional-commits]: https://conventionalcommits.org
[semver-spec]: https://semver.org/
[contributing_md]: https://github.com/TomerFi/version-bumper/blob/dev/CONTRIBUTING.md
[version-bumper-action]: https://github.com/marketplace/actions/version-bumper-action
[all-contributors]: https://allcontributors.org/
[all-contributors-badge]: https://img.shields.io/github/all-contributors/tomerfi/version-bumper?style=plastic&label=%20&color=b7b1e3
[docker-version-badge]: https://img.shields.io/docker/v/tomerfi/version-bumper?style=social&logo=docker&label=%20
[npm-version-badge]: https://img.shields.io/npm/v/@tomerfi/version-bumper?style=social&logo=npm&label=%20