Giter Club home page Giter Club logo

Comments (8)

onur avatar onur commented on July 20, 2024 2

@isaacs that figures:

> require('semver/package.json').version
'2.1.0'

TBH I don't know why this behavior is changed but old one seems more correct to me. Ranges are useless if a crate have a pre-release string. And * means any except it's not any.

Anyway I am closing this issue since semver crate is using node-semver behavior.

from semver.

steveklabnik avatar steveklabnik commented on July 20, 2024

Yes, this is intended behavior. You only get prerelease versions when explicitly asking for them. This is consistent with other semver implementations, take https://semver.npmjs.com/ and try matching * vs 1.0.0-rc.1.

which then confuses me why you say

I tried node's semver and * is matching (satisfying) fine with 0.1.0-pre.0.

@isaacs, do you know what's up here?

from semver.

onur avatar onur commented on July 20, 2024

Another example from semantic_version python module:

>>> from semantic_version import Spec, Version
>>> Spec('*').match(Version('0.1.0-pre.0'))
True

I think * range is only different in npm. In theory * means any and it should match any valid semver.

from semver.

steveklabnik avatar steveklabnik commented on July 20, 2024

I haven't had the time to check, but IIRC Bundler also doesn't give you prerelase explicitly.

In theory * means any and it should match any valid semver.

That depends, it should match any released version, imho, and pre-releases aren't real releases.

Anyway, this library will try to be as compatible with the rest of the ecosystem as possible, but if it's not standard across the ecosystem, then we'll do what I think is right 😉

from semver.

isaacs avatar isaacs commented on July 20, 2024

Nope, it doesn't, by design.

$ semver -r '*' 1.0.0-pre

$ echo $?
1

https://github.com/npm/node-semver/#prerelease-tags

from semver.

isaacs avatar isaacs commented on July 20, 2024

Obviously I can't speak for Python's semantic_version module, though. I'm assuming it works for its purposes. Version range specifiers are much less standardized than versions themselves, but cargo and npm are mostly in sync with one another.

from semver.

onur avatar onur commented on July 20, 2024

@isaacs I am wondering why all these examples are returning true:

> var semver = require('semver')
> semver.satisfies('0.1.0-pre.0', '*')
true
> semver.satisfies('0.1.0-pre.0', '0.1')
true
> semver.satisfies('0.1.0-pre.0', '^0')
true
> semver.satisfies('0.1.0-pre.0', '0')
true

I only need this kind of behavior from semver crate. semver crate is returning false for all of these.

from semver.

isaacs avatar isaacs commented on July 20, 2024

@onur Probably you're using a very outdated version of semver.

> var semver = require('./')
undefined
> semver.satisfies('0.1.0-pre.0', '*')
false
> semver.satisfies('0.1.0-pre.0', '0.1')
false
> semver.satisfies('0.1.0-pre.0', '^0')
false
> semver.satisfies('0.1.0-pre.0', '0')
false
> require('semver/package.json').version
'5.3.0'
> require('./package.json').version
'5.3.0'

from semver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.