Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPM compatibility #7

Open
algobardo opened this issue Feb 2, 2017 · 5 comments
Open

NPM compatibility #7

algobardo opened this issue Feb 2, 2017 · 5 comments

Comments

@algobardo
Copy link

algobardo commented Feb 2, 2017

The following checks throw an exception, while are regular constraints in npm

new Semver("0.0.7", SemverType.NPM).satisfies("~1.9.1-6")
new Semver("3.3.1", SemverType.NPM).satisfies(">=2.4.x")
new Semver("3.3.1alpha", SemverType.NPM).satisfies(">=2.4.0")
@vdurmont
Copy link
Owner

vdurmont commented Feb 9, 2017

@algobardo any idea why? I don't have the time to look into it yet but if you figure out why and send a fix, I will gladly merge it!

@mpostelnicu
Copy link

i have the same problem, the issue is in: Requirement.evaluateReversePolishNotation(Requirement.java:357) where a Range is constructed with SemverType.LOOSE even when the given type is NPM.

  public Range(String version, RangeOperator op) {
        this(new Semver(version, Semver.SemverType.LOOSE), op);
    }

So none of the satisfies methods work with ANY type except LOOSE , does not matter if u force NPM, or anything else....

new Semver("3.3.1", SemverType.NPM).satisfies(">=2.4.x") fails and
new Semver("3.3.1", SemverType.NPM).satisfies(Requirement.buildNPM(">=2.4.x")) fails as well, the Range will always create a LOOSE type which does not accept 'x' as patch notation...

maybe @vdurmont can help, this seems a serious problem... i integrated this library into a validator tool with dependencies of NPM style, and expected some basic functionality, like the satisfies method, and reading versions and patch versions, nothing more, and got quite surprised it's not working even with the simple examples on the homepage... am i using it incorrectly ? if not, then we need to write some test cases... and i can help with fixing stuff, it's just i don't understand why you used Semver.SemverType.LOOSE in the Range constructor, maybe there's a reason....

thanks much !!

@algobardo
Copy link
Author

algobardo commented Aug 10, 2017

Have you tried if the same happens on what we have https://github.com/algobardo/semver4j ?
I attempted to solve some of the problems in #12

mpostelnicu added a commit to devgateway/oc-explorer that referenced this issue Aug 11, 2017
@mpostelnicu
Copy link

i don't want to repackage the library as artifact myself and i don't want to use the source code directly, so for the moment i patched my code not to use wildcards... thanks anyway.

@piotrooo
Copy link

@algobardo if you are still interesting, I've made copy of this lib and fix bug reported by you. Look for version 2.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants