Yarn: Allow install only production dependencies in flat mode.

Created on 25 Feb 2017  路  9Comments  路  Source: yarnpkg/yarn

What is the current behavior?
yarn install --prod --flat asks resolution for both production and development modules and then install all of them.

What is the expected behavior?
yarn install --prod --flat should install only production dependencies.

Most helpful comment

Glad I found this issue as I was just trying to do the same combo of --flat --production.

For a frontend web project, is it safe to assume that you'd always want your dependencies to be flat installed? Otherwise you'd end up shipping multiple versions of a component or library down to the client which is inherently wasteful.

For devDependencies I think it's totally fine to use the regular nested node install because those are often build tools.

This is something that we in the web components community are really interested in because Custom Elements require you to only register one version of a tag (e.g. you can't have two versions of <x-button> on the page). So flat install is something we're super excited about.

Ideally I'd like to be able to do something like:

yarn install --dependencies --flat --module-folder client_modules
yarn install --dev-dependencies

All 9 comments

PR is welcome

Currently --flat requires you to resolve all conflicting modules... it would be great if there was some kind of "ignore" option to only flat-install _some_ modules.

Glad I found this issue as I was just trying to do the same combo of --flat --production.

For a frontend web project, is it safe to assume that you'd always want your dependencies to be flat installed? Otherwise you'd end up shipping multiple versions of a component or library down to the client which is inherently wasteful.

For devDependencies I think it's totally fine to use the regular nested node install because those are often build tools.

This is something that we in the web components community are really interested in because Custom Elements require you to only register one version of a tag (e.g. you can't have two versions of <x-button> on the page). So flat install is something we're super excited about.

Ideally I'd like to be able to do something like:

yarn install --dependencies --flat --module-folder client_modules
yarn install --dev-dependencies

3251 will fix this.

@kittens, so this works using the command line?

What about in the package.json? Something like:

flat: 'production'
//or
flat: 'dev'
//or
flat: true

you can do it in .yarnrc file https://yarnpkg.com/en/docs/yarnrc#toc-cli-arguments

@bestander I am unclear whether you can choose to install only dependencies in flat mode while continuing to install devDependencies in nested mode. @BYK says that you cannot do this in #4380 but here it is unclear.

Seems like this is not possible at the moment and #3251 is not related :(
Any plans, thoughs ? Without any solution, for web project, dev dependencies generates like 200 unmaintainable resolutions :(

I also would like to see this issue solved. Any ideas when it could be implemented?

Was this page helpful?
0 / 5 - 0 ratings