Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Shorthand syntax for ranges like ">=1.2 <2.0"? #38
I'm guessing this has already been brought up in the past, but I couldn't find this discussion on the web. I'm sorry if this is a recurring question.
In my understanding of semver v2, it should be safe (and desirable, I think) to install packages of greater Minor versions than the minimal one with which the package was originally implemented, because Minor bumps should be backwards-compatible.
Desirability comes from the idea that if I implement something that depends on module
It takes a very diligent maintainer to fix a bug of 1.2 functionality on version 1.9.x and create a 1.2 bugfix for it. In fact, he would need to create one bugfix for each Minor version in the 1.2~1.9 range, or at least for each tag in that range. Normally, they just tell you to update the package if you encounter problems, which is fine, but currently that's only automatically done by npm in bugfix increments, since people are instructed to use 1.2.x notation.
Even though Minor bumps mostly introduce new functionality, they may also introduce bugfixes that I would like npm to install for me without requiring me to update my
Set your dependency to version 1.x.x?
In that case it's not clear what's the minimal Minor version the module is
On Sat, Jul 6, 2013 at 10:16 AM, Adam Tuttle firstname.lastname@example.org:
I would say, if you consider this behavior interesting like I do, that's actually the behavior I'd expect from the tilde. I don't think its current meaning matches any meaninful semver understanding. Why would you not accept Minor updates? Since they are to be backwards compatible, the only reason would be to avoid bigger dependencies, and I don't think that's so important, do you? Granted, incorporating bugfixes in greater Minor versions would be much more important than that.
Of course, the loosened tilde should still match no prerelease versions.
Also, because of the nature of Minor bumps, loosening the current implementation of the tilde shouldn't break anything either. It could even be done in
I know this may sound minor (no pun intended), but once you give it some thought, let me know your rationale not to loosen
referenced this issue
Jul 15, 2013
I was also a little surprised to discover that
However, it does seem that it would make sense for there to be a shorthand for this, since it really should be in a sense the "default" - it maps closest to the meaning "I require at minimum package level X, but would like all backwards-compatible updates".
Here's two options that might not suck too much for the proposed operator:
Of course there are plenty of other options, and I think it's far less important which particular operator is used than that there is one. Ideally someday maybe it could even be the default for