mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #32699 from printercu/patch-3
Respect NODE_ENV when running `rails yarn:install`
This commit is contained in:
commit
9480618f06
1 changed files with 7 additions and 1 deletions
|
@ -3,7 +3,13 @@
|
|||
namespace :yarn do
|
||||
desc "Install all JavaScript dependencies as specified via Yarn"
|
||||
task :install do
|
||||
system("./bin/yarn install --no-progress --frozen-lockfile --production")
|
||||
# Install only production deps when for not usual envs.
|
||||
valid_node_envs = %w[test development production]
|
||||
node_env = ENV.fetch("NODE_ENV") do
|
||||
rails_env = ENV["RAILS_ENV"]
|
||||
valid_node_envs.include?(rails_env) ? rails_env : "production"
|
||||
end
|
||||
system({ "NODE_ENV" => node_env }, "./bin/yarn install --no-progress --frozen-lockfile")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue