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

fix(semver): Add a necessary grouping #3674

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

futsuuu
Copy link
Contributor

@futsuuu futsuuu commented Sep 25, 2023

This PR fixes an issue where if the prerelease starts and ends with a number, it is judged as a number.

before

const version = "1.0.0-1b3" // prerelease: "1b3", but matches with /^0|[1-9]\\d*$/
parse(version).prerelease   // -> [ 1 ]

after

const version = "1.0.0-1b3" // prerelease: "1b3", doesn't match with /^(0|[1-9]\\d*)$/
parse(version).prerelease   // -> [ "1b3" ]

@futsuuu futsuuu requested a review from kt3k as a code owner September 25, 2023 04:48
@CLAassistant
Copy link

CLAassistant commented Sep 25, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the fix.

@kt3k
Copy link
Member

kt3k commented Sep 25, 2023

Note: Ids like 1b3 should be considered alphanumeric identifier (because it includes b char), but currently it's handled like numeric identifier because of this error. This PR fixes it. ref. https://semver.org/#spec-item-9

@kt3k kt3k merged commit 2884033 into denoland:main Sep 25, 2023
@futsuuu futsuuu deleted the fix/semver-wrong-regex branch September 25, 2023 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants