-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Do you want to request a feature or report a bug?
I want to request a feature.
yarn install currently does the same as npm install, it installs the package in the current working directory. That's good, totally expected.
We have a repository that contains one root package, which contains a lot of developer dependencies (like Jest, ESLint, etc). Inside this repository, we have a modules directory which in turn has a new subdirectory for each package. As such, it could be visualised like this:
- package.json
- modules/
- module-a/
- package.json
- module-b/
- package.json
- module-a/
Currently, with npm, we parse the modules subdirectories for package.json files and cd to each of them to perform an npm install. In this example above, we would have three node_modules directories. A lot of these modules (a and b), share dependencies, even with the same version ranges. These are currently installed multiple times, which is unwanted.
We would like to be able to install these three package.json files into a single node_modules directory in the root of the project. This means if module-a and module-b both require jQuery, we would only need to install it once instead of twice (or twenty times...).
This should be a command line option, something like: yarn install --packages=package.json,modules/*/package.json.
It would parse all matching package.json files and create one big dependency tree, and then install this dependency tree into one node_modules directory that is at least accessible by the top-level package.json.
This would also allow a single lock file to be used, instead of (in this example), 3.
Please mention your node.js, yarn and operating system version.
Node 6.5.0, Yarn 0.15.1, Ubuntu 14.04 (VM)