semver icon indicating copy to clipboard operation
semver copied to clipboard

Allow pre-releases when the range uses them

Open carolynvs opened this issue 2 years ago • 6 comments

Currently, when a range uses a pre-release, such as 1.0.0-alpha.1 - 1.1.0, all pre-release versions are being rejected when the constraint is checked because the upper part of the range does not include a pre-release. For example, 1.0.0-alpha.2 should match that range, but it is rejected right now.

I have updated how we evaluate constraints so that it checks whether a constraint part uses pre-releases OR the larger constraint range that it is part of uses a pre-release. When either part of a range uses a pre-release, the entire range should allow pre-release versions.

Fixes #177

carolynvs avatar Aug 09 '22 20:08 carolynvs

Note, I have ideas how to modify this work so it only checks prereleases on the prerelease ranges. It involves some deeper cutting changes. If you want, I can pick up the work from here and try to change it.

mattfarina avatar Aug 15 '22 16:08 mattfarina

Ope, sorry for the slow turnaround, I was on vacation for a couple weeks there. I'm back now and have a bit of a start on handling the case you added.

carolynvs avatar Aug 29 '22 13:08 carolynvs

After looking at it more, I'm not sure how best to go about only applying the pre-release to a single range, since the range is immediately removed and converted into another representation when the constraint is parsed. If you have an idea for how to make this work well, please have at it! 👍

carolynvs avatar Aug 30 '22 13:08 carolynvs

Any updates on this request?

draithat avatar Feb 22 '23 10:02 draithat

@mattfarina Sorry for the really long delay getting a fix for the test case you brought up. Please take another look?

carolynvs avatar Mar 17 '23 17:03 carolynvs

I've fixed the merge conflict and this is ready to review.

carolynvs avatar Apr 05 '23 17:04 carolynvs