-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
fix(arborist): omit failed optional dependencies from installed deps,… #8177
base: latest
Are you sure you want to change the base?
Conversation
Pretty sure all the test failures are just the tests needing to be updated because the nodes themselves don't go anywhere anymore. |
oh no it didn't quite work how embarrassing. Oh well see you monday :P |
probably need to fix load-actual-tree too or something. |
… but keep them 'in the tree' Fixes: npm#4828 Fixes: npm#7961 Replaces: npm#8127 Replaces: npm#8077 When optional dependencies fail, we don't want to install them, for whatever reason. The way this "uninstallation" is done right now is by simply removing the dependencies from the ideal tree during reification. Unfortunately, this means that what gets saved to the "hidden lockfile" is the edited ideal tree as well, and when NPM runs next, it'll use that when regenerating the "real" package-lock. This PR tags failed optional deps such that they're still added to the "trash list" (and thus have their directories cleaned up by the reifier), but prevents Arborist from removing them altogether from the ideal tree (which is usually done by setting their parent to `null`, making them unreachable, and letting them get GC'd).
Alright, this works now. No more thrashing, and the test suite is passing. There's 6 lines missing coverage, but as we talked about, I'll let you take care of it from here, @owlstronaut :) |
see fix implemented here, discussed at: npm/cli#4828 (comment) soon there will be a PR to address so we may be able to remove these optional dependencies once this PR is merged: npm/cli#8177
… but keep them 'in the tree'
Fixes: #4828
Fixes: #7961
Replaces: #8127
Replaces: #8077
When optional dependencies fail, we don't want to install them, for whatever reason. The way this "uninstallation" is done right now is by simply removing the dependencies from the ideal tree during reification.
Unfortunately, this means that what gets saved to the "hidden lockfile" is the edited ideal tree as well, and when NPM runs next, it'll use that when regenerating the "real" package-lock.
This PR tags failed optional deps such that they're still added to the "trash list" (and thus have their directories cleaned up by the reifier), but prevents Arborist from removing them altogether from the ideal tree (which is usually done by setting their parent to
null
, making them unreachable, and letting them get GC'd).PS: It's Friday, this is what I managed to get done together. I'm making this a draft PR for now so folks can look at it, but I want to make sure both reifiers work well, fix some messaging issues, and clean stuff up (I'm pretty sure I'm guarding
ideallyInert
in more places than I need to, because I was trying to find the right spot). Still, feel free to talk about the approach. I'll get back to this on Monday.PPS: also hi