1

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.

1 Answer 1

6

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/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.