YulePale
YulePale

Reputation: 7666

Semantic versioning in npm

I am reading this npm docs about semantic versioning.

I have seen that this syntax is used to tell npm what packages to install.

Patch releases: 1.0 or 1.0.x or ~1.0.4

Minor releases: 1 or 1.x or ^1.0.4

Major releases: * or x

So my question is: If I set the semver of a package as *1.9.0, can it install any version of the package? And since major versions have breaking changes when is this syntax used?

Upvotes: 0

Views: 732

Answers (1)

xuhdev
xuhdev

Reputation: 9323

*1.9.0 is invalid.

* means >=0.0.0. See detailed explanation:

Any of X, x, or * may be used to "stand in" for one of the numeric values in the [major, minor, patch] tuple.

* := >=0.0.0 (Any non-prerelease version satisfies, unless includePrerelease is specified, in which case any version at all satisfies)
1.x := >=1.0.0 <2.0.0-0 (Matching major version)
1.2.x := >=1.2.0 <1.3.0-0 (Matching major and minor versions)

Upvotes: 0

Related Questions