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?

1
  • 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 Commented Nov 27, 2014 at 17:10

1 Answer 1

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.

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

1 Comment

Hi Matthew, this is perfect, >=1.2.0 <=1.3.0 is exactly what I'm looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.