incr is a tool to help you easily increment the version number of your NPM or Mix packages.
What does incr do?
The process is detailed as follow:
- Find the relevant file(s) (e.g.:
package.jsonandpackage-lock.jsonormix.exs). - Determine the existing version number.
- Increment the specified segment. If you increment the minor segment, the patch segment is set to 0 and the same goes for the major segment, the minor and patch segments are set to 0.
- Write the newly incremented version number in the relevant file(s).
- Create a new
git commitwith the relevant file with the version number as the default message (e.g.: 0.2.1). - Create a new annotated
git tagpointing to the newgit commitwith the version number prefixed by a 'v' as the name (e.g.: v0.2.1). - 💥
Installation
incr
~> gem install incrUsage
To increment the patch segment of your NPM package version number:
~> incr npm patchTo increment the minor segment of your Mix package version number:
~> incr mix minorArguments
Here are some arguments that can be used with incr:
-
-d: Directory where to search for the version files (default:.) -
-t: Tag name pattern, where%swill be replaced with the new version (default:v%s) -
--[no-]commit: Commit changes. (default: enabled) -
--[no-]tag: Create a git tag. (default: enabled)
Example:
~> incr --no-tag -d ./subprojects/web/ -t my-custom-tag-prefix/%s npm patchThis will :
- Search for
package.jsonandpackage-lock.jsonfiles inside./subprojects/web/and update the patch version - Commit the changes under the message
my-custom-tag-prefix/2.3.4 - Not create a tag with the new version
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/jcouture/incr. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.