Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

NPM package versioning

On npm I read:

To help developers who rely on your code, we recommend starting your package version at 1.0.0 and incrementing as follows:

Assuming that the way packages are actually versioned in the real world matches the above recommendation; when they use the ambiguous word "incrementing", do they mean to recommend:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  1. The next release to be versioned either 1.0.1, 1.1.0 or 2.0.0
  2. The next release to be versioned anything greater than 1.0.0 (e.g. even 1.0.9)

Relevant example:

You have "your-package" published on npm as v1.0.0
You work on it, refactor the code, fix a bunch of bugs and tag the last commit as v1.0.1
Then you notice a serious bug and after fixing it, you put a v1.0.2 tag

Now you decide to publish a release, if you was to publish the release as v1.0.2 (without a v1.0.1 ever being published) would you be going against npm recommendation?

>Solution :

The general rule is that the versions you publish should use this scheme, which is called semantic versioning. If you’ve made a public v1.0.1 release in the repository, even if you haven’t published it to npm, then you should make the next bugfix release v1.0.2. You definitely should not upload your tagged v1.0.2 release to npm as v1.0.1, since that’s going to cause a lot of confusion.

However, absent a compelling reason, you should try not to have gaps in the way that you publish. Sometimes that happens for whatever reason, say, due to a CI bug, but overall you should try to avoid it.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading