Fix NPM spec less comparison with prerelease bug.
This PR fixes this bug: https://github.com/rbarrois/python-semanticversion/issues/100.
Thanks for the contribution! Could you explain why this fixes the bug? Ideally in comments or the commit message, but I can add it myself — as long as I understand it :D
@rbarrois So without the fix, this is what happens.
>>> from semantic_version import NpmSpec, Version
>>> NpmSpec("<1.2.3-beta.7").clause
AnyOf(AllOf(Range('<', Version('1.2.3'), prerelease_policy='same-patch')), AllOf(Range('<', Version('1.2.3-beta.7'), prerelease_policy='same-patch'), Range('>=', Version('1.2.0'), prerelease_policy='always')))
Notice there is this clause AllOf(Range('<', Version('1.2.3'), prerelease_policy='same-patch')), so every prerelease (alpha-1,2,3,4,..., beta-1,2,3,4,...., rc-1,2,3,4,....) version always matches because versions 1.2.3-rc.4 or 1.2.3-alpha.7 or 1.2.3-beta.8 is always less than version 1.2.3. Basically, my fix removes this clause.
To be fair, I consider my patch as a quick fix, not as a holistic one. I don't fully understand how NPM spec matching engine works. :)
I mean I can update the PR to add a comment but I just need to make sure you are okay with my patch.