1

I maintain an AngularJS library called Angular Modal Service. I would like to change the dependencies so that I target AngularJS 1.3, like this:

"dependencies": {
  "angular": "~1.3.0"
}

However, I know categorically that the library works for ~1.2. I don't want to force consumers who want the latest version of my code to have to upgrade, it is possible to do this:

"dependencies": {
  "angular": "~1.3.0 | ~1.2.0"
}

Letting my library remain low impact? And if it is possible, is it in fact appropriate? Are there any good guidelines on this?

Dave Kerr
  • 5,117
  • 2
  • 29
  • 31
  • Hi Matthew, the only reason I haven't gone for that is the inability to set the maximum version (although from what you've said it sounds like you can do it). If you can set the maximum version, how? And can it be set in the form 1.3.x (i.e. 1.3 plus any minor release?) BTW if that works please write as an answer and I'll accept it – Dave Kerr Nov 27 '14 at 17:10

1 Answers1

1

One of the things you can do is use your lowest minimum version and allow every version greater than that

>=1.2.0

But what might be better is to also put the highest possible version that you have tested just in case there is a future version that isn't compatible.

>=1.2.0 <=1.3.0

Or a shorthand version of that might look something like this

1.2.0 - 1.3.0

If you remove the second equal sign from the above what you end up with is a version syntax that node calls an x-range which can be shortened to this

1.2.x

which is the same as

>=1.2.0 <1.3.0

All of this and more can be found on the node semver page.

Matthew Green
  • 10,161
  • 4
  • 36
  • 54