Automate new releases for node.js projects on the command line.
A new release is defined as:
- An incremental increase to the version property in the package.json and package-lock.json files.
- A commit of the two json files with a descriptive message about the reason for the version bump.
- The optional creation of a tag with a descriptive message.
npm install --global @bzelip/bump
This will install bump globally so that it can be run from the command line.
There are two main commands:
bump <strategy> <message>
bump undo
Bump your version based on a strategy, and include a description of the reason for the bump in the generated commit message.
bump <strategy> <message>
strategy
(string, required)- strategy for the version bump
- Choices:
-
major
-
minor
-
patch
-
message
(string, required)- description of the reason for the version bump, to be appended to the generated commit message
# current version 0.4.0
bump minor "create custom slider"
🍑: Successfully minor bumped version to 0.5.0 with the commit message:
"package*: v0.5.0 Bump minor for create custom slider 🎉"
Note bump
does not push, it only commits locally.
Undo a bump.
bump undo
This command is an alias for running:
git reset HEAD~
git checkout -- package*
Note Be sure to only use bump undo
immediately after bump <strategy> <message>
to have the desired action.
- your project is git tracked
- you are following Semantic Versioning
- your current working directory includes both package.json and package-lock.json files
- add the create tag with message option
- add tests
My current release protocol includes:
- git
- a Semantic Versioning approach
- a changelog.md
- once a feature branch's work is finalized and documented in changelog.md:
- open package.json, bump the version accordingly
- open package-lock.json, bump the version accordingly
- commit with message of the form
package*: v${version} ${strategy} bump for ${message} 🎉
- TODO: create new tag with command of the form:
tag v${version} -m ${message}
- push to remote, and start the PR process (do this manually after bump.js)
- push new tag to remote (do this manually after bump.js)