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

Version Path
vite_rails-1.0.10 lib/tasks/vite/install_dependencies.rake
vite_rails-1.0.9 lib/tasks/vite/install_dependencies.rake
vite_rails-1.0.8 lib/tasks/vite/install_dependencies.rake
vite_rails-1.0.7 lib/tasks/vite/install_dependencies.rake
vite_rails-1.0.6 lib/tasks/vite/install_dependencies.rake
vite_rails-1.0.5 lib/tasks/vite/install_dependencies.rake
vite_rails-1.0.4 lib/tasks/vite/install_dependencies.rake
vite_rails-1.0.3 lib/tasks/vite/install_dependencies.rake
vite_rails-1.0.2 lib/tasks/vite/install_dependencies.rake
vite_rails-1.0.1 lib/tasks/vite/install_dependencies.rake