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

[BUG] Raw includes build only before modification #562

Closed
1 task done
skeletorXVI opened this issue Jun 2, 2023 · 2 comments · Fixed by #565
Closed
1 task done

[BUG] Raw includes build only before modification #562

skeletorXVI opened this issue Jun 2, 2023 · 2 comments · Fixed by #565
Labels
Bug thing that needs fixing Priority 1 high priority issue

Comments

@skeletorXVI
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When creating a new instance of the SemVer class form a version string with a build, the build segment is included in the raw field.

Expected Behavior

The build segment should either be or not be part of the raw field, but not a mix of both.

Steps To Reproduce

Copy and run the following example code which should log true but instead logs false.

const { SemVer } = require("semver");

const freshInstance = new SemVer("1.0.0-rc.2+build.4");
const modifiedInstance = new SemVer("1.0.0-rc.1+build.4");
modifiedInstance.inc("prerelease", "rc");
console.log(freshInstance.raw === modifiedInstance.raw);

Environment

  • yarn: 3.5.0
  • Node: v16.19.1
  • OS: Pop!Os 22.04
  • semver: 7.5.1
@skeletorXVI skeletorXVI added Bug thing that needs fixing Needs Triage needs an initial review labels Jun 2, 2023
@ljharb
Copy link

ljharb commented Jun 2, 2023

semver in the node ecosystem doesn't really use the build segment. just curious, what's your use case?

@skeletorXVI
Copy link
Author

skeletorXVI commented Jun 2, 2023

We actually use it in GitHub Actions within my companies organization to automatically validate and generate releases.

The only reason I noticed this inconsistency has to do with the fact that it broke the unit tests when adding a new feature.

lukekarrys added a commit that referenced this issue Jun 15, 2023
lukekarrys added a commit that referenced this issue Jun 15, 2023
@lukekarrys lukekarrys added Priority 1 high priority issue and removed Needs Triage needs an initial review labels Jun 15, 2023
lukekarrys added a commit that referenced this issue Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 1 high priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants