-
Notifications
You must be signed in to change notification settings - Fork 239
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
Restore npm 6 ability to install one package #364
base: main
Are you sure you want to change the base?
Conversation
In a few projects, I have scripts to explicitly install and uninstall single packages, for the purposes of testing different combinations. For example, enzyme needs to test on a number of combinations of react, react-dom, and a few other packages - but every time I install one of them, other unrelated changes happen to the package tree. |
Is this solved by It wouldn't be too hard to apply a similar filter to non-workspace package names, now that Arborist.reify can do this for workspaces. Just would need to figure out the best way to express it in the API surface. |
Adding context here: This was only the behavior in npm v6 if a package-lock.json file is not present. Otherwise, it'll still install everything in the lockfile. npm v7 is by design more consistent in its behavior when a lockfile is present vs when it is not. If we are going to add this, it will have to be an opt-in feature. Breaking the default (which was the default in v6, since lockfiles were created by default in v6) would be too disruptive. Making npm v7 behave differently based on the presence of a lockfile (beyond the difference of "using that as a starting point for the idealTree") is not something we're going to want to do. All that said, it won't be hard to do. Just need to figure out the UX for which flags to use, how to opt in, etc., and then build up the set of |
Co-authored-by: Tierney Cyren <accounts@bnb.im>
Co-authored-by: Tierney Cyren <accounts@bnb.im>
I feel like this will be succeeded by the |
In projects that I work on, we'd also like to be able to install only one package (or a subset of packages) without needing to install the whole dependency tree as suggested in a Similar to @ljharb, we want to be able to dynamically uninstall and install dependencies for testing, benchmarking, etc. Not being able to do so (as in npm |
Another usecase: |
@cbn-falias would |
I have a Node.js script that will require packages that it needs, so I'd like to install just those packages beforehand in test environments. I don't think I can run |
@louh you can run |
@bnb Yes this would also work but I don't see a way to use it with configurations from
|
@cbn-falias I can understand that use case, but I don't know how this would solve that problem as proposed - you'd still need to get the version from the |
Another use case we have is that we periodically need to investigate issues in older Node.js versions which are not officially supported. Various dependencies may have dropped support for such versions, so we've taken to maintaining a set of config files listing versions of those dependencies which are compatible with the older Node.js versions. We then have scripts which read those config files and selectively try to install those dependencies so that we can run in older Node.js versions. With npm v7, we have to introduce workarounds, such as temporarily copying and overwriting the main |
Any progress? |
I ended up extracting the version with a powershell-script and then calling it this way:
|
@darcyclarke (when you're back from vacation): perhaps worth putting this on the agenda again? |
Yes please; it continues to be a massive annoyance and inconvenience to be unable to have an atomic command do a thing atomically. |
Is there any update on how this feature will be implemented? |
No detail given but we have a tracking issue right now for At a high-level though (from previous discussions) I believe we'd start warning when |
@darcyclarke hopefully we'd add |
although i'm not clear on why |
No description provided.