Skip to content

remove version parsing from #name selector, remove npm-package-arg, remove semver #24

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

Merged
merged 3 commits into from
Oct 11, 2022

Conversation

wraithgar
Copy link
Member

@wraithgar wraithgar commented Oct 10, 2022

BREAKING CHANGE: You can no longer select a version along with an name
selector (i.e. #npm@9.0.0). Use #name:semver() instead.

semver and dependency type selectors collide in syntax, so we are no
longer trying to parse a version with a name selector.

An example can show why this is impossible to parse:
@npmcli/test-package@1.2.3-pre.prod.

There is no way to know if .prod is supposed to be the .prod
dependency type selector or if it is part of the pre-release section of
the version. So now you must use one of these two syntaxes depending on
what the version actually is:

If .prod is part of the version:
#@npmcli/test-package:semver(1.2.3-pre.prod)

If .prod is a dependency type selector:
#@npmcli/test-package:semver(1.2.3-pre).prod

@wraithgar wraithgar requested a review from a team as a code owner October 10, 2022 18:02
@wraithgar wraithgar marked this pull request as draft October 10, 2022 18:06
BREAKING CHANGE: You can no longer select a version along with an name
selector (i.e. `#npm@9.0.0`).  Use `#name:semver()` instead.

semver and dependency type selectors collide in syntax, so we are no
longer trying to parse a version with a name selector.

An example can show why this is impossible to parse:
`@npmcli/test-package@1.2.3-pre.prod`.

There is no way to know if `.prod` is supposed to be the `.prod`
dependency type selector or if it is part of the pre-release section of
the version.  So now you must use one of these two syntaxes depending on
what the version actually is:

If `.prod` is part of the version:
`#@npmcli/test-package:semver(1.2.3-pre.prod)`

If `.prod` is a dependency type selector:
`#@npmcli/test-package:semver(1.2.3-pre).prod`
It was only being used when trying to parse versions as part of the
`#name` selector.
@wraithgar wraithgar force-pushed the gar/npa-breaking-changes branch from 311acdf to 058763e Compare October 11, 2022 14:24
@wraithgar wraithgar changed the title fix: Properly parse #foo@1 and #foo@* remove version parsing from #name selector, remove npm-package-arg Oct 11, 2022
It was only being used when trying to parse versions as part of the
`#name` selector
@wraithgar wraithgar marked this pull request as ready for review October 11, 2022 14:26
@wraithgar wraithgar changed the title remove version parsing from #name selector, remove npm-package-arg remove version parsing from #name selector, remove npm-package-arg, remove semver Oct 11, 2022
Copy link
Contributor

@nlf nlf left a comment

Choose a reason for hiding this comment

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

this breaking change makes a lot of sense 👍

@wraithgar wraithgar merged commit 2b4e8f8 into main Oct 11, 2022
@wraithgar wraithgar deleted the gar/npa-breaking-changes branch October 11, 2022 18:00
@github-actions github-actions bot mentioned this pull request Oct 11, 2022
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.

2 participants