-
Notifications
You must be signed in to change notification settings - Fork 629
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
deprecation(semver): deprecate SemVerRange
, introduce Range
#4161
deprecation(semver): deprecate SemVerRange
, introduce Range
#4161
Conversation
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.
Sorry, Tim. Can you please resolve the merge conflicts? I also noticed that the removal version for some added deprecation notices is 0.213.0 and others 0.214.0. Can you please only have one version so removals can happen all at the same time?
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 mostly agree with this PR. The only part I'm slightly uncertain about is having Comparator
extend SemVer
. Either way. I left a few suggestions.
Also, I notice we still use some deprecated functions within other functions. We should look into switching to the updated functions in those cases. Probably best done after this PR, separately.
@@ -12,5 +12,5 @@ import { format } from "./format.ts"; | |||
*/ | |||
export function comparatorFormat(comparator: Comparator): string { | |||
const { semver, operator } = comparator; | |||
return `${operator}${format(semver)}`; | |||
return `${operator}${format(semver ?? comparator)}`; |
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.
Nice. Can we please have tests for added functionality? We want to ensure that both SemVer
and Comparator
inputs work fine on all these functions, including those in this PR.
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.
How do you mean exactly?
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 added some test cases. PTAL.
@@ -47,5 +47,5 @@ export function parseComparator(comparator: string): Comparator { | |||
} | |||
: ANY; | |||
|
|||
return { operator, semver }; | |||
return { operator, ...semver, semver }; |
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 forsee the output of this object being confusing to users during the deprecation period. But I don't see another viable way of doing this. Food for thought...
i don't see a better way to remove the
I'll have a look at that after this PR. I think we might be best of putting all comparator code into one |
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Done |
This looks like an immediate breaking change to me. [
[
{
operator: ">=",
major: 1,
minor: 2,
patch: 3,
prerelease: [],
build: [],
semver: { major: 1, minor: 2, patch: 3, prerelease: [], build: [] }
},
{
operator: "<",
major: 2,
minor: 0,
patch: 0,
prerelease: [],
build: [],
semver: { major: 2, minor: 0, patch: 0, prerelease: [], build: [] }
}
]
] instead of: {
ranges: [
[
{
operator: ">=",
semver: { major: 1, minor: 2, patch: 3, prerelease: [], build: [] }
},
{
operator: "<",
semver: { major: 2, minor: 0, patch: 0, prerelease: [], build: [] }
}
]
]
} It's typed like both are supported, but actually only |
I feel this kind of thing can't be done in a non-breaking way. |
|
Ah, ok. Sorry I missed |
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
SemVerRange
to Range
SemVerRange
, introduce Range
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.
LGTM
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.
LGTM! Nice work, Tim! Thank you.
This PR does a bunch of things. While some things could theoretically be split up into separate PRs (ref: #4059), some stand-alone PRs might look redundant.
SemVerRange
type in favour ofRange
.isSemVerRange()
in favour ofisRange()
Comparator.semver
property optional in favour ofComparator
extendingSemVer
that allows a simpler and less nestedRange
type.Note:
Comparator
might become be deprecated (ref: deprecation(semver): deprecateComparator.semver
property #4059 (comment)), but becauseSemVerRange
is dependent on its structure, it needs to be changed in order to avoid breaking changes.