Skip to content

fix: semver.diff prerelease to release recognition - #533

Merged
wraithgar merged 1 commit into
mainfrom
pull/334
Apr 10, 2023
Merged

fix: semver.diff prerelease to release recognition#533
wraithgar merged 1 commit into
mainfrom
pull/334

Conversation

@wraithgar

@wraithgarwraithgar commented Apr 5, 2023

Copy link
Copy Markdown
Contributor

Cleanup of #334
Closes#333

Authored by @deefactorial

@wraithgar
wraithgar requested a review from a team as a code ownerApril 5, 2023 23:32
@wraithgar
wraithgar requested review from lukekarrys and removed request for a teamApril 5, 2023 23:32
Comment threadfunctions/diff.js Outdated
Comment threadfunctions/diff.js Outdated
@H4ad

H4ad commented Apr 7, 2023

Copy link
Copy Markdown
Contributor

In this line:

constv1=parse(version1)
constv2=parse(version2)

If we parse it first, we can speedup this from 300k op/s to ~470k to ~500k op/s.

Like this:

constv1=parse(version1)constv2=parse(version2)if(eq(v1,v2)){

Because eq also parse the version, so we parse it twice in this method without need.

Should I open another PR for this one?

EDIT: I opened a PR just to not mix the bugfix and the perf fix.

@H4adH4ad mentioned this pull request Apr 7, 2023
@wraithgar
wraithgarforce-pushed the pull/334 branch 3 times, most recently from 6a4fd89 to cc279ffCompareApril 7, 2023 01:18
nlf
nlf approved these changes Apr 10, 2023

@nlfnlf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this one was a bit confusing and is a little unintuitive, but it does make sense. for future readers here's what helped me wrap my head around it:

the versions 1.0.0, 1.1.0-pre and 1.1.0 would sort in that same order. the transition from 1.0.0 to 1.1.0-precould be considered a pre-release, but it's also a minor and since the minor is the more impactful change that's what we report the diff as.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] semver.diff returns incorrect responses

4 participants

@wraithgar@H4ad@nlf@dominique-blockchain