Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

version bump when updating readme for npm package?

Tags:

node.js

npm

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.

like image 833
chovy Avatar asked Nov 09 '12 06:11

chovy


People also ask

How do I update npm packages to a specific version?

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.


2 Answers

Depending on your definition of "need to", this could be two very different questions:

  1. [Is it ok to publish readme changes without bumping the version number?]

  2. [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.

like image 118
cweekly Avatar answered Oct 12 '22 11:10

cweekly


npm publish --force will overwrite if version number already exists in registry.

https://npmjs.org/doc/publish.html

like image 20
srquinn Avatar answered Oct 12 '22 12:10

srquinn