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

fix(install): make sure to reload explicitRequests #211

Merged
merged 2 commits into from Jan 29, 2021
Merged

Conversation

wraithgar
Copy link
Member

When we are placing our deps, if our edge dep was explicitly requested,
we want to re-place it instead of leaving whatever was there before.

This will mean doing something like npm install foo will install the
latest version of foo that your tree currently allows, instead of
doing nothing if any version already existed

References

Closes npm/cli#2243

@isaacs
Copy link
Contributor

isaacs commented Jan 28, 2021

LGTM once it has a test that fails without it and passes with it.

@wraithgar
Copy link
Member Author

Test output if I comment out the fix in build-ideal-tree.js

  not ok must match snapshot
    --- expected                                                                                                         
    +++ actual                                                                                                           
    @@ -12,10 +12,9 @@                                                                                                   
           },                                                                                                            
           "location": "node_modules/lodash",                                                                            
           "name": "lodash",                                                                                             
           "path": "{CWD}/test/arborist/build-ideal-tree-existing-dep-that-needs-to-be-reinstalled/node_modules/lodash", 
    -      "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",                                          
    -      "version": "3.10.1",                                                                                          
    +      "version": "3.9.1",                                                                                           
         },                                                                                                              
       },                                                                                                                
       "edgesOut": Map {                                                                                                 
         "lodash" => EdgeOut {                                                                                           

@wraithgar wraithgar marked this pull request as ready for review January 29, 2021 19:21
@wraithgar wraithgar force-pushed the gar/install-latest branch 3 times, most recently from 66c01f3 to 9d9c579 Compare January 29, 2021 19:36
@isaacs isaacs self-requested a review January 29, 2021 20:11
Copy link
Contributor

@isaacs isaacs left a comment

Choose a reason for hiding this comment

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

LGTM.

nlf and others added 2 commits January 29, 2021 15:31
when we are placing our deps, if our edge dep was explicitly requested,
we want to re-place it instead of leaving whatever was there before.

This will mean doing something like `npm install foo` will install the
latest version of `foo` that your tree currently allows, instead of
doing nothing if any version already existed

PR-URL: #211
Credit: @wraithgar
Close: #211
Reviewed-by: @isaacs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] npm install foo lacks the implicit @latest that v6 has
3 participants