Do you want to request a feature or report a bug?
feature complementing already existing and working install
option
What is the current behavior?
There is no way to set Yarn to permanently (per project) install dependencies to custom directory.
What is the expected behavior?
Although custom install directory can be set on CLI via yarn install --modules-folder vendor/node_modules
there should be a section in package.json
file so --modules-folder
doesn't have to be specified all the time.
I propose to add new section to package.json
root named modules-folder
. This would hold string value representing path where dependencies should be installed (same as when specified on CLI) relative to the package.json
file.
User should be able to override the setting by specifying --modules-folder
on CLI.
Also they should be able to use yarn config
to work with the setting.
And lastly the https://yarnpkg.com/en/docs/package-json shoud be updated.
Please mention your node.js, yarn and operating system version.
yarn 0.20.3, Alpine Linux
Thanks for consideration.
I think all flags should be configurable via .yarnrc.
Not sure if we should allow yarn specific config via package.json
Maybe, but even using yarn config set modules-folder vendor/node_modules
does not make it use the specified directory. Is it not implemented yet?
Btw, there is only one brief mention of .yarnrc
file on https://yarnpkg.com
Yeah, it is not yet implemented.
Great if you send a PR :)
We could really use this feature!
I second that!
If https://bower.io/blog/2017/how-to-migrate-away-from-bower/ the please with the same config in the json config file.
I tried looking into why the config set by yarn config set modules-folder vendor/node_modules
wasn't being used, and it's because this results in the line modules-folder vendor/node_modules
in the .yarnrc
. Since yarn's RC loading code looks for lines prefixed with --
to set config options, if you manually edit this line to instead read --modules-folder vendor/node_modules
, yarn install
will use it correctly.
If you try yarn config set --modules-folder vendor/node_modules
you currently get: error Invalid subcommand. Try "set, get, delete, list, current"
.
yarn config set -- --modules-folder vendor/node_modules
works, but for some reason interprets this as ~/vendor/node_modules
instead of project/vendor/node_modules
@himdel This seems to do absolutely nothing in version 1.10.1
.
Is it supposed to write to .yarnrc
?
@paxperscientiam Yup :)...
--- ~/.yarnrc-before 2018-11-02 11:41:22.704147321 +0000
+++ ~/.yarnrc-after 2018-11-02 11:41:11.476046733 +0000
@@ -2,5 +2,6 @@
# yarn lockfile v1
+"--modules-folder" vendor/node_modules
lastUpdateCheck 1541085232301
save-prefix "~"
@himdel Yeah, i figured out some since: https://github.com/yarnpkg/yarn/issues/6594#issuecomment-436387507
Most helpful comment
We could really use this feature!