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

Discussion(semver): Necessity of Comparator #4047

Closed
timreichen opened this issue Jan 1, 2024 · 4 comments
Closed

Discussion(semver): Necessity of Comparator #4047

timreichen opened this issue Jan 1, 2024 · 4 comments

Comments

@timreichen
Copy link
Contributor

Background

ref: #4037 (review), #4037 (comment)

This issue explores, if Comparator is necessary in the semver module.

@kt3k What made you think that Comparator might not be necessary?

@timreichen timreichen mentioned this issue Jan 1, 2024
13 tasks
@kt3k
Copy link
Member

kt3k commented Jan 2, 2024

Comparator looks like an internal utility interface. It is very limited version of SemVerRange. I think the users are usually interested in working with SemVerRanges and not Comparators.

Comparator still needs to be exposed as a public type because it's part of public SemVerRange, but I think the users are not interested in APIs which accepts/outputs comparators (e.g. parseComparator, testComparator)

@timreichen
Copy link
Contributor Author

I agree. Comparator is probably not very useful as part of the public api. I think we should remove it from the public api.
However, working with SemVerRange directly is kinda clunky because

  • it has an obsolete ranges property
  • it represents an array of arrays of Comparators
    That might not be a problem when using parseRange, but it is when using objects. Creating a simple Range is a bit awkward:
const simpleRange = { ranges: [ [ { operator: "=", semver: { major: 1, minor: 2, patch: 3 } } ] ] }

We might need to find a good solution to simplify usage. (related: #3967)

@timreichen
Copy link
Contributor Author

timreichen commented Jan 8, 2024

Ok, I will go forward and create a PR to deprecate all public Comparator functions.

@iuioiua
Copy link
Contributor

iuioiua commented Jan 9, 2024

Completed in #4131.

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

No branches or pull requests

3 participants