Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Only install devDependencies #998

Closed
peterjuras opened this issue Oct 13, 2016 · 12 comments
Closed

Feature request: Only install devDependencies #998

peterjuras opened this issue Oct 13, 2016 · 12 comments

Comments

@peterjuras
Copy link

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

dependencies are always installed and there is no command to prevent that.

What is the expected behavior?

Similar to npm install --only=dev a CLI option to only install devDependencies.

(My) usecase: Compile only environments where the resulting build will be used in a docker container (with a separate yarn install)

@coreyc
Copy link

coreyc commented Nov 18, 2016

Is this still an open request? If so, I was going to take a swing at it.

@wyze
Copy link
Member

wyze commented Nov 18, 2016

Go ahead @coreyc.

@steebchen
Copy link

steebchen commented Nov 18, 2016

@coreyc This would be incredibly cool. I have a "helper package" which has 20-30 dependencies in production, but locally I only need two devDependencies.

@SharpEdgeMarshall
Copy link

SharpEdgeMarshall commented Nov 23, 2016

Actually we are having an issue that could be solved by this feature.
We are using docker-compose with 2 services one to compile (webpack) and one to run the server (web) and a shared volume for the build output.
The issue arise because we use a .env file to pass NODE_ENV var to both services

if we set NODE_ENV=production to test production behaviour the webpack service isn't able to compile because yarn will install only dependencies.

So the solution we are adopting is this in the webpack service:
command: bash -c "NODE_ENV=development yarn && NODE_ENV=production npm run build"

It would be cool if we could specify to force install devDependencies even if NODE_ENV=production

@coreyc
Copy link

coreyc commented Nov 23, 2016

@SharpEdgeMarshall I think this feature is slightly different than what you're talking about, but will take a look at it.

Due to holiday week, been slightly delayed but I am working on this.

@SharpEdgeMarshall
Copy link

I noticed after commenting that the feature requested by @peterjuras could completely solve our issue, exactly as him we have a build container and we could use ONLY devDepencies.
With --dev flag our cmd could became command: bash -c "yarn --dev && npm run build"

@joeyespo
Copy link
Contributor

@SharpEdgeMarshall I ran into something similar on Heroku, which sets both NODE_ENV and NPM_CONFIG_PRODUCTION variables. I think #1975 would help your case too.

In npm, NPM_CONFIG_PRODUCTION takes precedence over NODE_ENV for whether to install devDependencies. In Yarn, it's currently the opposite.

@nsgundy
Copy link

nsgundy commented Feb 6, 2017

@coreyc Thanks for the PR. Will you have time to finish it or would it be best to have someone else give it a try?

@coreyc
Copy link

coreyc commented Feb 7, 2017

@nsgundy I had some open questions that weren't answered in the PR comments. Re-familiarizing myself with the code now. Will update the PR soon.

@coreyc
Copy link

coreyc commented Feb 10, 2017

@nsgundy thought i could spare some time to finish this, but can't make the time. you can look at the PR, it's close to being finished anyway.

@mirague
Copy link

mirague commented Feb 28, 2017

+1 would love to see this!

@bestander
Copy link
Member

duplicate of #3254.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.