Martin Dawson
Martin Dawson

Reputation: 7656

NPM Versions update major number on every breaking change?

Let's say my npm package of 1.0.0 publicly exposes a function called foo for users to use among many other functions and features.

I then remove the foo function which will break for all the users who are using this function.

NPM says:

Changes which break backwards compatibility: Major release, increment the first number, e.g. 2.0.0

I'm quite confused exactly what this means. Should the major number be updated always if we break a change for users even if it's just a small change such as removing a function?

At the moment I update the major number whenever I possibly break a publicly exposed feature. I see npm packages with small major versions and thinking that I am incorrect in doing this as I am updating my own packages major number very fast.

Upvotes: 1

Views: 1262

Answers (1)

hya
hya

Reputation: 1738

Each API change (e.g. removing endpoint, function from lib, or changing behavior of endpoint/function) which may impact clients should update MAJOR number. MINOR and PATCH tells client that library/API is stable for one MAJOR version.

Given a version number MAJOR.MINOR.PATCH, increment the:

  • MAJOR version when you make incompatible API changes,
  • MINOR version when you add functionality in a backwards-compatible manner, and
  • PATCH version when you make backwards-compatible bug fixes.

You can read more at http://semver.org/

Upvotes: 6

Related Questions