admin管理员组文章数量:1323687
Background
I have been using bower
for handling dependencies, however now I would like to migrate to yarn
. The main hurdle I am having is migrating from the below .bowerc
file to .yarnrc
.
.bowerrc
{
"directory": "src/vendors"
}
The issue is I could make a .yarnrc
file, like below that will put any dependency into src/vendors
, but that includes devDependencies.
.yarnrc
--modules-folder src/vendors
Question
How do I only put dependencies into src/vendors
and putdevDependencies
in node_modules
?
Background
I have been using bower
for handling dependencies, however now I would like to migrate to yarn
. The main hurdle I am having is migrating from the below .bowerc
file to .yarnrc
.
.bowerrc
{
"directory": "src/vendors"
}
The issue is I could make a .yarnrc
file, like below that will put any dependency into src/vendors
, but that includes devDependencies.
.yarnrc
--modules-folder src/vendors
Question
How do I only put dependencies into src/vendors
and putdevDependencies
in node_modules
?
2 Answers
Reset to default 6An alternative way to acplish the same thing as in the answer above (but without the .yarnrc
files) is by adding two different scripts to package.json
, something along these lines:
"scripts": {
"install-depends": "yarn install --production=true --modules-folder ./src/vendors",
"install-devDepends": "yarn install --production=false"
}
Then you just run them in that same order (if you do it the other way around, it will wipe out everything in the node_modules
:
yarn run install-depends
yarn run install-devDepends
You could use --production
option to tell yarn which dependencies you want to install; if set to true
it will just install dependencies
.
So in your src
folder make a .yarnrc
file with the following content:
--modules-folder vendors
--production true
and in your project dir, in .yarnrc
file, set --production
to false:
--production false
folder structure:
.
├── package.json
├── src
│ └── .yarnrc
└── .yarnrc
本文标签: javascriptHow do I only put dependencies into a specific folder for yarnStack Overflow
版权声明:本文标题:javascript - How do I only put dependencies into a specific folder for yarn? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742137962a2422453.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论