Skip to content

semver.satisfies(): '*' doesn't match prerelease identifiers  #130

Closed

Description

@myndzi

semver.satisfies('0.3.16-foo.1', '*') -> false

Activity

  1. megawac commented on Jul 13, 2015

    @megawac
    Contributor

    See #123, related npm/npm#8855

  2. myndzi commented on Jul 13, 2015

    @myndzi
    Author

    Even after browsing that issue, it is unclear to me why a specifier that literally means "anything" should not match... well, anything. Additionally, it appears that there is no way, then, to construct such a comparison?

  3. isaacs commented on Jul 13, 2015

    @isaacs
    Contributor

    @myndzi The principle at work here is that 0.3.16-foo.1 is a "prerelease" version. Prereleases can include breaking changes at any time, and frequently don't even satisfy the API contracts inherent in a module, so they're excluded from any ranges that don't explicitly opt-in to a pre-release version in that chain. So, for example, it would match ~0.3.16-alpha, but that range would not be satisfied by 0.3.17-foo.1, because that is a prerelease of a different version.

  4. myndzi commented on Jul 13, 2015

    @myndzi
    Author

    I can understand this, to an extent, in the context of a partial version (say, 1.*), but * is literally "everything", so how can anything fall "outside" this range?

  5. myndzi commented on Jul 13, 2015

    @myndzi
    Author

    More importantly, I guess, it seems that the ability to opt in to or out of prerelease matches should more properly be an option passed to the semver.satisfies function, so that the user can control the behavior, rather than a forced behavior that only satisfies one of two needs...

  6. isaacs commented on Jul 14, 2015

    @isaacs
    Contributor

    Having an option to allow prerelease matches against non-prerelease version ranges would be fine. It'd be tricky to get the API right, though, especially since there's already one boolean and adding another one edges a bit too far down the slippery slope of long function signatures. Maybe it'd be ok to replace the loose params with an options object, or have loose matches also allow prerelease versions to match against ranges?

  7. qzb commented on Jul 14, 2015

    @qzb

    In my opinion new x-ranges for prerelease versions would be a good idea. For example 1.3.*-* should match to all prereleases of 1.3.*, and * || *-* to any version at all (prerelease or not).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions