Sha256: 6b3977a00c8ad5dec1dc32b69ffff05c68d5f907c36fcf3035bbfa94122ccb9f
Contents?: true
Size: 753 Bytes
Versions: 10
Compression:
Stored size: 753 Bytes
Contents
# frozen_string_literal: true namespace :vite do desc 'Support for older Rails versions. Install all JavaScript dependencies as specified via Yarn' task :install_dependencies do valid_node_envs = %w[test development production] node_env = ENV.fetch('NODE_ENV') { valid_node_envs.include?(Rails.env) ? Rails.env : 'production' } Dir.chdir(Rails.root) do install_command = if Rails.root.join('yarn.lock').exist? v1 = `yarn --version`.start_with?('1') "yarn install #{ v1 ? '--no-progress --frozen-lockfile' : '--immutable' }" elsif Rails.root.join('pnpm-lock.yaml').exist? 'pnpm install' else 'npm ci' end system({ 'NODE_ENV' => node_env }, install_command) end end end
Version data entries
10 entries across 10 versions & 1 rubygems