Skip to content

Automate new version releases for node.js projects

License

Notifications You must be signed in to change notification settings

brianzelip/bump

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bump 🍑

GitHub package.json version

Automate new releases for node.js projects on the command line.

A new release is defined as:

  1. An incremental increase to the version property in the package.json and package-lock.json files.
  2. A commit of the two json files with a descriptive message about the reason for the version bump.
  3. The optional creation of a tag with a descriptive message.

Install

npm install --global @bzelip/bump

This will install bump globally so that it can be run from the command line.

Use

There are two main commands:

  1. bump <strategy> <message>
  2. bump undo

bump

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

Example

Input
# current version 0.4.0

bump minor "create custom slider"
Output
🍑: 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

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.

Assumptions

  • your project is git tracked
  • you are following Semantic Versioning
  • your current working directory includes both package.json and package-lock.json files

TODO

  • add the create tag with message option
  • add tests

My release protocol

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:
    1. open package.json, bump the version accordingly
    2. open package-lock.json, bump the version accordingly
    3. commit with message of the form package*: v${version} ${strategy} bump for ${message} 🎉
    4. TODO: create new tag with command of the form: tag v${version} -m ${message}
    5. push to remote, and start the PR process (do this manually after bump.js)
    6. push new tag to remote (do this manually after bump.js)

References

  1. How do I prompt users for input from a command-line script?
  2. Execute a command line binary with Node.js
  3. node.child_process.exec code examples
  4. How to append to New Line in Node.js
  5. node.os.EOL
  6. package.json
  7. publishing scoped public packages
  8. How to use yargs
  9. My accepted answer to a yargs question on !SO

About

Automate new version releases for node.js projects

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published