-
Notifications
You must be signed in to change notification settings - Fork 227
Use valid semvers internally #436
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
Conversation
|
Yes please, this would be great. If you fix the build error I’ll do a quick check and get this in. Thanks! |
| const firstTypedVersion = min( | ||
| mapDefined(versions, ({ hasTypes, version }) => (hasTypes ? version : undefined)), | ||
| (a, b) => b.greaterThan(a) | ||
| semver.compare |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use semver.compare().
| (info.versions.has(notNeeded.versionString) && | ||
| !assertDefined(info.versions.get(notNeeded.versionString)).deprecated) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!isAlreadyDeprecated() ensures notNeeded is either < latest or not deprecated.
| } | ||
| const needsPublish = canPublish && pkg.contentHash !== latestVersionInfo.typesPublisherContentHash; | ||
| const patch = needsPublish | ||
| ? latestVersion!.minor === pkg.minor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
latestPatchMatchingMajorAndMinor() ensures latestVersion.minor === pkg.minor.
| }); | ||
| return best(versionsWithTypings, (a, b) => a > b); | ||
| ): string | null { | ||
| return semver.maxSatisfying([...versions.keys()], `~${major}.${minor}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced latestPatchMatchingMajorAndMinor() with the equivalent semver.maxSatisfying(..., `~${major}.${minor}`)
1b99e76 to
53072ff
Compare
|
|
@sandersn any objections? |
Can we remove
semver.ts, and instead use the standardsemvernpm package, which is similar?semver.tsdoesn't handle some valid cases, e.g. andrewbranch/definitely-not-slow@d9d0828#diff-02cbc9970890cd33cf15c9ffb2f983aa63db1d290949662f06c134dad8fc9270R192 whereas switching to the standard package allows versions to be parsed consistently.