Skip to content

[BUG] diff('2.0.0-alpha.15', '2.0.0') returns prerelease when it should return major #288

@lazd

Description

@lazd

What / Why

A bump from an alpha of a major release to the actual major release is considered a prerelease by diff when it's actually a major release.

When

  • Always

Where

  • npm/semver

How

Current Behavior

  • diff('2.0.0-alpha.15', '2.0.0') returns prerelease

Steps to Reproduce

const semver = require('semver');
semver.diff('2.0.0-alpha.15', '2.0.0'); // == prerelease

Expected Behavior

  • diff('2.0.0-alpha.15', '2.0.0') returns major
  • That is, the output of diff('2.0.0-alpha.15', '2.0.0') should be consistent with inc('2.0.0-alpha.15', 'major').
  • When we increment 2.0.0-alpha.15 by major, we get 2.0.0, and when we diff 2.0.0-alpha.15 against 2.0.0, we should also get major.

Who

  • n/a

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions