Skip to content
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

> Co-authored-by: Vincent Bailly [vibailly@microsoft.com](mailto:vibailly@microsoft.com) #4240

Open
Syndrom-Fnale opened this issue Feb 16, 2023 · 0 comments

Comments

@Syndrom-Fnale
Copy link

          > Co-authored-by: Vincent Bailly [vibailly@microsoft.com](mailto:vibailly@microsoft.com)

Added an --install-strategy=(hoisted | linked) config option for npm install and arborist reify.

The new linked install mode, dedupes and installs packages in a flat structure in node_modules/.store, and then links the directories in node_modules. Unlike hoisted (the previous and current default behavior), linked installs are not hoisted, and while the .store directories are deduped, the tree is not. Links are not hoisted.

One added benefit is that dependencies and workspaces will no longer work by coincidence when a shared package is required but the dependency was accidentally omitted from one or more parents.

This new install mode may break packages that depend on hoisted behavior. The package-lock.json will not change when switching modes.

This is a draft PR with the following known TODOS:

  • solve resolved URL linking in reify (currently breaking 1 line of coverage)
  • remove dependency on hash-graph-nodes
  • properly handle when a workspace is also bundled
  • readability
  • potential for performance improvements

Longer term (outside the scope of this PR):

  • remove need for emulated tree by converting Node class into proper Proxy and isolating logic

Originally posted by @Syndrom-Fnale in npm/cli#5492 (comment)

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

No branches or pull requests

1 participant