Search code examples
node.jsnpmsemantic-versioning

How to specify minimal and maximal version of dependency in package.json?


Assume that package localization@2.0.0 requires peer dependency of package library of minimal version 1.1.0 and maximal version1.5.4. With JavaScript, the logical expression will be:

libraryVersion >= 1.1.0 && libraryVersion <= 1.5.4

But how to express same condition in peerDependencies (and other types of dependencies) filed of package.json? I did not find the logic operator and in semver documentation.

{
  "peerDependencies": {
     "library": ">=1.2.7 "
   }
}

Solution

  • This isn't possible. You can do something like "library": "1.x" but that's it.