If I modify my readme for an npm package I maintain, do I need to bump the version in package.json and do another npm publish? or is there another way to update the readme without a version bump.
To update a specific package, we need to run the npm update command followed by the package name. Sometimes, you want to update a package to the specific version in such cases you need to use npm install command by specifying a version number after the package name.
Depending on your definition of "need to", this could be two very different questions:
[Is it ok to publish readme changes without bumping the version number?]
[Is it technically possible to publish changes without incrementing the version]
The accepted answer (updating via npm publish --force
, i.e. without incrementing any part of the version number) is a good answer to Q2. But I want to address Q1.
Use of npm publish --force
is discouraged. Instead, authors are encouraged to use semantic versioning aka semver, which prescribes:
... version format of X.Y.Z (Major.Minor.Patch). Bug fixes not affecting the API increment the patch version, backwards compatible API additions/changes increment the minor version, and backwards incompatible API changes increment the major version.
So my answer is: While there is technically a way to publish changes without a version bump, you shouldn't do that. For minor edits that don't affect the package's API, you should bump the "patch" version, e.g. from 1.2.0 to 1.2.1.
npm publish --force
will overwrite if version number already exists in registry.
https://npmjs.org/doc/publish.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With