Consider a package with running versions:
1.0.0
1.0.1
1.0.2
given the semver policy ~1.0.0
- we'll get the latest patch - and life is great.
Now consider that version 1.0.3
has landed and is an offending version, so we expect 1.0.4
to correct the offense.
I don't want to wait for the authors to depricate 1.0.3
, and it's anyway on my builder cache. I hope to handle this using the semver policy.
Is there a way I can phrase my semver policy to exclude that offending version, so that until a fix is released I'll get 1.0.2
, and after its released I'll get 1.0.4
?
And - if 1.0.4
is also offending, what will be the way to exclude both 1.0.3
and 1.0.4
so I'll get 1.0.5
as soon as it's published?
Thanks
CodePudding user response:
Ah.. found it. I was looking in the wrong place for that...
The way to do that is:
"dependencies": {
"the-package" : "~1.0.0 > 1.0.3 || > 1.0.4",
and when 1.0.4
is found offensive, then
"the-package" : "~1.0 > 1.0.3 || > 1.0.5",
It works with ^
as well, if you like, not just ~
.
I expected to find it on the https://semver.org site, but the examples are here, with an interactive playground: