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.
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). - Runs
npm run buildonly if the package defines abuildscript. - Bumps the patch version without creating a git tag (
npm version patch --no-git-tag-version). - Runs
npm installso the lockfile reflects the new version. - Commits
package.jsonandpackage-lock.json(chore: bump patch version). - Pushes to
origin master. - Publishes to npm (
npm publish).
npm install --save-dev release-patchAdd 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-patch- The package is a git repository with a
masterbranch and anoriginremote. - You have publish rights to the package on npm.
ISC