Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

[BUG] only use savePrefix+version if that's a subset of the supplied version range #127

Closed
isaacs opened this issue Sep 11, 2020 · 0 comments
Assignees
Labels
Bug thing that needs fixing

Comments

@isaacs
Copy link
Contributor

isaacs commented Sep 11, 2020

re: npm/cli#193

If the user provides an install range, and savePrefix + resolvedVersion is not a subset of that supplied version range, then we should save the supplied version range rather than using the savePrefix.

For example:

npm i foo@'1.x <1.2'
# resolves to foo@1.1.2, should save as '1.x <1.2' rather than '^1.1.2', because not a subset

npm i foo@'>1.0.0'
# resolves to foo@1.1.2, should save as '^1.1.2', because that's a subset of supplied range
@darcyclarke darcyclarke added dependencies Backlog a "backlogged" item that will be tracked in a Project Board Agenda will be discussed at the Open RFC call and removed Release 7.x Agenda will be discussed at the Open RFC call Backlog a "backlogged" item that will be tracked in a Project Board labels Sep 16, 2020
@ruyadorno ruyadorno assigned isaacs and unassigned ruyadorno Sep 28, 2020
@darcyclarke darcyclarke added this to the OSS - Sprint 16 milestone Sep 28, 2020
isaacs added a commit that referenced this issue Sep 28, 2020
If a user installs `foo@1.x <1.2.3`, and we resolve to `1.2.2`, then we
should not save it as `^1.2.2`, since that would allow versions outside
of the requested range.

Explicit versions and tags are still saved using the savePrefix, since
those are not ranges, and users can set `--save-exact` if they wish it
to be saved exactly.

Fix: #127
Fix: npm/cli#193
Fix: https://npm.community/t/7005
@darcyclarke darcyclarke added Bug thing that needs fixing Release 7.x labels Sep 28, 2020
isaacs added a commit that referenced this issue Sep 28, 2020
If a user installs `foo@1.x <1.2.3`, and we resolve to `1.2.2`, then we
should not save it as `^1.2.2`, since that would allow versions outside
of the requested range.

Explicit versions and tags are still saved using the savePrefix, since
those are not ranges, and users can set `--save-exact` if they wish it
to be saved exactly.

Fix: #127
Fix: npm/cli#193
Fix: https://npm.community/t/7005
@isaacs isaacs closed this as completed in 4b8f620 Sep 29, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Bug thing that needs fixing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants