diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-05-22 17:48:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-22 17:48:57 -0400 |
commit | 9480618f06ada9e06e8c95ca85d6242debad693a (patch) | |
tree | aec7a446ca647ec919887ebd374b2f4b5221bfeb /railties | |
parent | 2b2bf2c73bf37dfc8587aa531de0e88d16769630 (diff) | |
parent | 8e9186d241f24fe01a96a321900a182bc581c24e (diff) | |
download | rails-9480618f06ada9e06e8c95ca85d6242debad693a.tar.gz rails-9480618f06ada9e06e8c95ca85d6242debad693a.tar.bz2 rails-9480618f06ada9e06e8c95ca85d6242debad693a.zip |
Merge pull request #32699 from printercu/patch-3
Respect NODE_ENV when running `rails yarn:install`
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/tasks/yarn.rake | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/railties/lib/rails/tasks/yarn.rake b/railties/lib/rails/tasks/yarn.rake index 10703a1808..cf45a392e8 100644 --- a/railties/lib/rails/tasks/yarn.rake +++ b/railties/lib/rails/tasks/yarn.rake @@ -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 |