Automatically Bumping the NPM PatchVersion

Ole Ersoy
1 min readJan 2, 2020
Image by Gerd Altmann from Pixabay

Scenario

We currently have our package.json patch version from 1.1.1 to 1.1.2 .

Approach

Install version-bump-prompt :

npm install -g version-bump-prompt

In your project directory run:

bump patch

Result:

✔ Updated package.json to 1.1.2
✔ Updated package-lock.json to 1.1.2

Bonus

Automating publishing:

"scripts": {
"dist": ...
"patch": "bump patch && npm run dist && cd dist && npm publish"
}

And:

npm run patch

--

--