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

BREAKING(semver): rewrite semver #3385

Merged
merged 89 commits into from
Jun 12, 2023
Merged

BREAKING(semver): rewrite semver #3385

merged 89 commits into from
Jun 12, 2023

Conversation

kt3k
Copy link
Member

@kt3k kt3k commented May 17, 2023

continuation of #3169.

This PR rewrites semver module, and make SemVer object immutable.

Remaining tasks. We needs to restore deprecated signatures to the below APIs:

  • intersects
  • maxSatisfying
  • minSatisfying
  • minVersion
  • toComparators
  • validRange

closes #3164

@kt3k
Copy link
Member Author

kt3k commented Jun 6, 2023

This should be ready now.

Renamed rangeTest, comparatorTest -> testRange, testComparator because the file names range_test.ts, comparator_test.ts causes multiple issues (because they are auto-detected as test files).

@kt3k kt3k requested review from bartlomieju and ry June 6, 2023 06:38
semver/mod.ts Outdated Show resolved Hide resolved
semver/mod.ts Outdated Show resolved Hide resolved
kt3k and others added 3 commits June 6, 2023 17:32
Co-authored-by: Tim Reichen <timreichen@users.noreply.github.com>
Co-authored-by: Tim Reichen <timreichen@users.noreply.github.com>
@kt3k
Copy link
Member Author

kt3k commented Jun 6, 2023

Summary of changes:

  • Remove SemVer class, instead add SemVer interface. SemVers are now represented as immutable plain objects. This closes refactor(semver): make SemVer class immutable #3164
  • Deprecate string overload for semver input from APIs. (Breaking change)
  • Add single-file export entrypoint for every API.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

While I haven't reviewed the actual implementation, I read through the API changes. The is gonna be quite a breakage for users, but I think it's for the better - it makes it way more obvious which operations are more costly and requires more care from the user.

LGTM

semver/gt.ts Outdated
s1: SemVer,
): boolean;
/**
* @deprecated (will be removed after 0.195.0) Use `gt(s0: SemVer, s1: SemVer)` instead.
Copy link
Member

Choose a reason for hiding this comment

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

It's great that the backwards compatibility is still preserver for know - I suggest we give it anywhere between 1-3 months before removing the deprecated API.

So maybe let's be more generous here and deprecate in 0.200.0?

Copy link
Member Author

Choose a reason for hiding this comment

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

0.200.0 sounds good to me 👍 Updated

Sign up for free to 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.

refactor(semver): make SemVer class immutable
6 participants