Effortlessly bump your npm package version from the command line. Ideal for pre-commit hooks, CI/CD, or any automated workflow.
Manually updating your package.json
version is easy to forget and error-prone. package-bump
automates this step, so your version is always up to date.
npx -y package-bump@latest [patch|minor|major] [--stage]
- Defaults to
patch
if no argument is given. - Add
--stage
to automatically re-stagepackage.json
after bumping (useful in pre-commit/pre-push hooks). - The
-y
flag skips the install confirmation prompt for a smoother experience.
npm install --save-dev package-bump
Add to your npm scripts:
{
"scripts": {
"bump": "package-bump minor --stage"
}
}
npm install -g package-bump
package-bump patch --stage
Pre-commit hook example (with husky)
npx -y husky add .husky/pre-commit "npx -y package-bump@latest patch --stage"
Usage: package-bump [patch|minor|major] [--stage]
patch Increment patch version (default)
minor Increment minor version
major Increment major version
--stage Re-stage package.json after bumping (for git hooks)
MIT