Specify different Yarn install paths for ‘devDependencies’ and ‘dependencies’
I’m using Yarn to manage my dependencies for my project. I have developer dependencies (devDependencies
) required for development and front-end dependencies (dependencies
) that my project will require and use to run. I use Git to manage my version control.
Yarn by default seems to install all dependencies in the node_modules
directory. This is fine for developer dependencies, but because I am using Git I typically ignore this directory. I would, however, like to commit my front-end dependencies and isolate them from developer dependencies.
I’m wondering if it’s possible to configure Yarn to install required dependencies in a separate directory from developer dependencies. For example:
devDependencies
would be installed in/node_modules
dependencies
would be installed in/vendor
Bower has similar functionality in the .bowerrc
file but I can't find anything similar for Yarn. I considered using Bower alongside Yarn for my front-end dependencies but that seems to defeat the purpose of using Yarn.
git npm bower yarnpkg
add a comment |
I’m using Yarn to manage my dependencies for my project. I have developer dependencies (devDependencies
) required for development and front-end dependencies (dependencies
) that my project will require and use to run. I use Git to manage my version control.
Yarn by default seems to install all dependencies in the node_modules
directory. This is fine for developer dependencies, but because I am using Git I typically ignore this directory. I would, however, like to commit my front-end dependencies and isolate them from developer dependencies.
I’m wondering if it’s possible to configure Yarn to install required dependencies in a separate directory from developer dependencies. For example:
devDependencies
would be installed in/node_modules
dependencies
would be installed in/vendor
Bower has similar functionality in the .bowerrc
file but I can't find anything similar for Yarn. I considered using Bower alongside Yarn for my front-end dependencies but that seems to defeat the purpose of using Yarn.
git npm bower yarnpkg
Have you made any progress here?
– vars
Jul 2 '17 at 18:55
--cwd
was recently added to Yarn to let you do this kind of thing. github.com/yarnpkg/yarn/pull/4174
– willoller
Aug 17 '17 at 22:02
Why do you want to commit your front-end dependencies in the repo? I can think of good and bad reasons to do that. Is it because you want to serve static HTML pages directly from your repository in agh-pages
branch? Are you trying to make sure that the code of your dependencies never changes?
– Rory O'Kane
Mar 5 '18 at 21:17
add a comment |
I’m using Yarn to manage my dependencies for my project. I have developer dependencies (devDependencies
) required for development and front-end dependencies (dependencies
) that my project will require and use to run. I use Git to manage my version control.
Yarn by default seems to install all dependencies in the node_modules
directory. This is fine for developer dependencies, but because I am using Git I typically ignore this directory. I would, however, like to commit my front-end dependencies and isolate them from developer dependencies.
I’m wondering if it’s possible to configure Yarn to install required dependencies in a separate directory from developer dependencies. For example:
devDependencies
would be installed in/node_modules
dependencies
would be installed in/vendor
Bower has similar functionality in the .bowerrc
file but I can't find anything similar for Yarn. I considered using Bower alongside Yarn for my front-end dependencies but that seems to defeat the purpose of using Yarn.
git npm bower yarnpkg
I’m using Yarn to manage my dependencies for my project. I have developer dependencies (devDependencies
) required for development and front-end dependencies (dependencies
) that my project will require and use to run. I use Git to manage my version control.
Yarn by default seems to install all dependencies in the node_modules
directory. This is fine for developer dependencies, but because I am using Git I typically ignore this directory. I would, however, like to commit my front-end dependencies and isolate them from developer dependencies.
I’m wondering if it’s possible to configure Yarn to install required dependencies in a separate directory from developer dependencies. For example:
devDependencies
would be installed in/node_modules
dependencies
would be installed in/vendor
Bower has similar functionality in the .bowerrc
file but I can't find anything similar for Yarn. I considered using Bower alongside Yarn for my front-end dependencies but that seems to defeat the purpose of using Yarn.
git npm bower yarnpkg
git npm bower yarnpkg
edited Mar 5 '18 at 21:08
Rory O'Kane
18.8k764108
18.8k764108
asked Mar 25 '17 at 3:32
ScoobaSteveScoobaSteve
1931315
1931315
Have you made any progress here?
– vars
Jul 2 '17 at 18:55
--cwd
was recently added to Yarn to let you do this kind of thing. github.com/yarnpkg/yarn/pull/4174
– willoller
Aug 17 '17 at 22:02
Why do you want to commit your front-end dependencies in the repo? I can think of good and bad reasons to do that. Is it because you want to serve static HTML pages directly from your repository in agh-pages
branch? Are you trying to make sure that the code of your dependencies never changes?
– Rory O'Kane
Mar 5 '18 at 21:17
add a comment |
Have you made any progress here?
– vars
Jul 2 '17 at 18:55
--cwd
was recently added to Yarn to let you do this kind of thing. github.com/yarnpkg/yarn/pull/4174
– willoller
Aug 17 '17 at 22:02
Why do you want to commit your front-end dependencies in the repo? I can think of good and bad reasons to do that. Is it because you want to serve static HTML pages directly from your repository in agh-pages
branch? Are you trying to make sure that the code of your dependencies never changes?
– Rory O'Kane
Mar 5 '18 at 21:17
Have you made any progress here?
– vars
Jul 2 '17 at 18:55
Have you made any progress here?
– vars
Jul 2 '17 at 18:55
--cwd
was recently added to Yarn to let you do this kind of thing. github.com/yarnpkg/yarn/pull/4174– willoller
Aug 17 '17 at 22:02
--cwd
was recently added to Yarn to let you do this kind of thing. github.com/yarnpkg/yarn/pull/4174– willoller
Aug 17 '17 at 22:02
Why do you want to commit your front-end dependencies in the repo? I can think of good and bad reasons to do that. Is it because you want to serve static HTML pages directly from your repository in a
gh-pages
branch? Are you trying to make sure that the code of your dependencies never changes?– Rory O'Kane
Mar 5 '18 at 21:17
Why do you want to commit your front-end dependencies in the repo? I can think of good and bad reasons to do that. Is it because you want to serve static HTML pages directly from your repository in a
gh-pages
branch? Are you trying to make sure that the code of your dependencies never changes?– Rory O'Kane
Mar 5 '18 at 21:17
add a comment |
1 Answer
1
active
oldest
votes
When you install a package to your repo you can install them by specifying -D at the end of it, for example yarn install some-package -D, this will add that package to the devDependencies tree in your package.json file, if You don't specify the -D that package will be added to the tree dependencies I believe that's how dependencies separation works
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43012220%2fspecify-different-yarn-install-paths-for-devdependencies-and-dependencies%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
When you install a package to your repo you can install them by specifying -D at the end of it, for example yarn install some-package -D, this will add that package to the devDependencies tree in your package.json file, if You don't specify the -D that package will be added to the tree dependencies I believe that's how dependencies separation works
add a comment |
When you install a package to your repo you can install them by specifying -D at the end of it, for example yarn install some-package -D, this will add that package to the devDependencies tree in your package.json file, if You don't specify the -D that package will be added to the tree dependencies I believe that's how dependencies separation works
add a comment |
When you install a package to your repo you can install them by specifying -D at the end of it, for example yarn install some-package -D, this will add that package to the devDependencies tree in your package.json file, if You don't specify the -D that package will be added to the tree dependencies I believe that's how dependencies separation works
When you install a package to your repo you can install them by specifying -D at the end of it, for example yarn install some-package -D, this will add that package to the devDependencies tree in your package.json file, if You don't specify the -D that package will be added to the tree dependencies I believe that's how dependencies separation works
answered Feb 6 at 18:12


Samuel ChavezSamuel Chavez
7116
7116
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f43012220%2fspecify-different-yarn-install-paths-for-devdependencies-and-dependencies%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you made any progress here?
– vars
Jul 2 '17 at 18:55
--cwd
was recently added to Yarn to let you do this kind of thing. github.com/yarnpkg/yarn/pull/4174– willoller
Aug 17 '17 at 22:02
Why do you want to commit your front-end dependencies in the repo? I can think of good and bad reasons to do that. Is it because you want to serve static HTML pages directly from your repository in a
gh-pages
branch? Are you trying to make sure that the code of your dependencies never changes?– Rory O'Kane
Mar 5 '18 at 21:17