Alexander Mills
Alexander Mills

Reputation: 99960

Set minimum patch version

Using semver as the standard, so I have this package version:

0.0.108

so in package.json for a Node.js project, I might have something like:

"foo":"^0.0.108"

my question is - using semver notation, how can I tell NPM not to install anything below 0.0.108? For example, 0.0.107 is unacceptable, but 0.0.109, or 0.0.111 is ok?

Upvotes: 0

Views: 133

Answers (1)

Half
Half

Reputation: 5498

If you don't want anything in 0.1.x, then this should work

>=0.0.108 <0.1

If you are okay with any future versions, such as major releases, then you only need

>=0.0.108

Note the semver spec (Section 4) and the npm documentation on semver (Caret Ranges) both suggest there can be breaking changes for every release when the minor version number is still 0, so you may have to deal with those if you decide not to use ^0.0.108.

Upvotes: 1

Related Questions