release-patch
v1.0.1
Published
Bump the patch version, sync master, commit, push and publish an npm package with a single command.
Maintainers
Readme
release-patch
Bump the patch version, sync master, commit, push and publish an npm package — all with a single command.
release-patch wraps the repetitive steps of cutting a patch release so any package can adopt the same flow just by installing it.
What it does
When run from a package's root directory, it:
- Logs in to npm if you are not already authenticated (
npm login). - Syncs
masterwithorigin/master(git checkout master,git fetch,git merge). - Bumps the patch version without creating a git tag (
npm version patch --no-git-tag-version). - Runs
npm run buildonly if the package defines abuildscript and itsversion/postversionlifecycle scripts do not already runbuild. - Commits
package.jsonandpackage-lock.jsonwhen present (chore: bump patch version). - Pushes to
origin master. - Publishes to npm (
npm publish).
npm version already updates package-lock.json when present, so release-patch does not run npm install. This also avoids triggering prepare during install.
npm publish still runs npm lifecycle scripts such as prepublishOnly, prepack, and prepare. Those hooks run after release-patch pushes the version commit, so they do not replace the pre-push build gate.
Install
npm install --save-dev release-patchUsage
Add a script to your package.json:
{
"scripts": {
"release:patch": "release-patch"
}
}Then cut a release:
npm run release:patchYou can also run it ad hoc without adding a script:
npx release-patchRequirements
- The package is a git repository with a
masterbranch and anoriginremote. - You have publish rights to the package on npm.
License
ISC
