Sha256: 91f18ca7e3e1dc754b4024a192b2a925469f2669f8c41efd11f7a05a41876bde

Contents?: true

Size: 805 Bytes

Versions: 92

Compression:

Stored size: 805 Bytes

Contents

# frozen_string_literal: true

namespace :yarn do
  desc "Install all JavaScript dependencies as specified via Yarn"
  task :install do
    # Install only production deps when for not usual envs.
    valid_node_envs = %w[test development production]
    node_env = ENV.fetch("NODE_ENV") do
      valid_node_envs.include?(Rails.env) ? Rails.env : "production"
    end

    yarn_flags =
      if `yarn --version`.start_with?("1")
        "--no-progress --frozen-lockfile"
      else
        "--immutable"
      end

    system(
      { "NODE_ENV" => node_env },
      "yarn install #{yarn_flags}",
      exception: true
    )
  rescue Errno::ENOENT
    $stderr.puts "yarn install failed to execute."
    $stderr.puts "Ensure yarn is installed and `yarn --version` runs without errors."
    exit 1
  end
end

Version data entries

92 entries across 88 versions & 9 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/railties-7.0.8.7/lib/rails/tasks/yarn.rake
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/railties-7.0.8.6/lib/rails/tasks/yarn.rake
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/railties-7.1.3.4/lib/rails/tasks/yarn.rake
railties-8.0.1 lib/rails/tasks/yarn.rake
railties-8.0.0.1 lib/rails/tasks/yarn.rake
railties-7.2.2.1 lib/rails/tasks/yarn.rake
railties-7.1.5.1 lib/rails/tasks/yarn.rake
railties-7.0.8.7 lib/rails/tasks/yarn.rake
railties-8.0.0 lib/rails/tasks/yarn.rake
railties-7.2.2 lib/rails/tasks/yarn.rake
railties-7.1.5 lib/rails/tasks/yarn.rake
railties-8.0.0.rc2 lib/rails/tasks/yarn.rake
railties-7.2.1.2 lib/rails/tasks/yarn.rake
railties-7.1.4.2 lib/rails/tasks/yarn.rake
railties-7.0.8.6 lib/rails/tasks/yarn.rake
railties-8.0.0.rc1 lib/rails/tasks/yarn.rake
railties-7.2.1.1 lib/rails/tasks/yarn.rake
railties-7.1.4.1 lib/rails/tasks/yarn.rake
railties-7.0.8.5 lib/rails/tasks/yarn.rake
railties-8.0.0.beta1 lib/rails/tasks/yarn.rake