incv v2.1.1
About The Project
Sometimes you need to bump the version in your package.json file automatically. For example, you might:
- Have a CI/CD pipeline, and want to automatically bump the patch version of your library on merge to your
develop
branch - Have a workflow (e.g. on Bitbucket Pipelines, GitHub actions etc.) that allows developers to automatically perform version bumps by including tags in their commit message (e.g.
[major]
,[minor]
) - Just want to reduce the chances of human error when bumping version numbers manually
incv is a command-line utility for doing all of the above.
This is a rough port of my version bumper library for Python, dodgem. That name was taken on the npm package registry aready so I went with incv for increment version. My imagination was apparently off its game when I created this repo.
Built With
This project uses:
Getting Started
Getting started is straightforward.
Prerequisites
You'll need Node.js 14 or newer with npm to install incv.
Installation
Install incv using npm and you're done.
npm install incv --save-dev
Test your installation with:
incv --help
You should see help documentation printed.
Usage
You can use incv --help
for detailed information on using the utility:
Simple version bumping tool for Node.js, with customizable tags.
Usage
$ incv [options]
Options
--commit-message, -c The commit message to use to bump the version (default: '')
--major-tag The major version bump tag to search for in commit messages (default: '[major]')
--minor-tag The minor version bump tag to search for in commit messages (default: '[minor]')
--patch-tag The patch version bump tag to search for in commit messages (default: '[patch]')
--prerelease-tag The prerelease version bump tag to search for in commit messages (default: '[prerelease]')
--build-tag The build version bump tag to search for in commit messages (default: '[build]')
--prerelease-token The prerelease token to prepend to the prerelease version (default: 'prerelease')
--build-token The build token to prepend to the build version (default: '')
--major Specifies that a major version bump should be performed (default: false)
--minor Specifies that a minor version bump should be performed (default: false)
--patch Specifies that a patch version bump should be performed (default: true)
--prerelease Specifies that a prerelease version bump should be performed (default: false)
--build Specifies that a build version bump should be performed (default: false)
--dry Specifies that the bumped version should not be written to disk (default: false)
--quiet Suppresses informational output (default: false)
Boolean options can be inverted by prefixing '--no-' (e.g. '--no-patch').
Examples
$ incv --major # Major version bump.
$ incv --commit-message='[major] First major release!' # Major version bump via commit message.
Example: Bump Minor Version
Bump the minor version of your project like this:
incv --minor
If you don't want to commit the change to disk, use --dry
like so:
incv --minor --dry
If the informational output given by the CLI is getting in the way of downstream processing, use --quiet
:
incv --minor --quiet
Example: From Commit Message
Dodgem can bump your project version based on a commit message. By default.
- If the message contains
[major]
then a major version bump will be performed - If the message contains
[minor]
then a minor version bump will be performed - Otherwise, a patch version bump will be performed
For example, to use your last git
commit message to bump your projects version.
incv --commit-message="$(git log -1)"
Example: Custom Tags
If the default [major]
and [minor]
tags don't suit you, and you'd perfer (major)
, (minor)
and an explicit (patch)
tag:
incv --commit-message="$(git log -1)" --major-tag='(major)' --minor-tag='(minor)' --patch-tag='(patch)' --no-auto-patch
Roadmap
See the open issues for a full list of proposed features (and known issues).
Contributing
Any contributions are very welcome. Please fork the project and open a PR, or open an issue if you've found a bug and/or would like to suggest a feature.
License
Distributed under the MIT License. See LICENSE.txt
for more information.
Contact
Saul Johnson - @lambdacasserole - saul.a.johnson@gmail.com
Project Link: https://github.com/lambdacasserole/incv
Acknowledgments
The following resources are awesome:
- Best-README-Template was used for this readme
- semver was used for parsing and bumping semver numbers