Convert from Webpack to Vite (#34450)
Co-authored-by: Renaud Chaput <renchap@gmail.com>
This commit is contained in:
		@@ -14,7 +14,9 @@ end
 | 
			
		||||
 | 
			
		||||
if Rake::Task.task_defined?('assets:precompile')
 | 
			
		||||
  Rake::Task['assets:precompile'].enhance do
 | 
			
		||||
    Webpacker.manifest.refresh
 | 
			
		||||
    Rake::Task['assets:generate_static_pages'].invoke
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
# We don't want vite_ruby to run yarn, we do that in a separate step
 | 
			
		||||
Rake::Task['vite:install_dependencies'].clear
 | 
			
		||||
 
 | 
			
		||||
@@ -1,34 +0,0 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
# Disable this task as we use pnpm
 | 
			
		||||
 | 
			
		||||
require 'semantic_range'
 | 
			
		||||
 | 
			
		||||
Rake::Task['webpacker:check_yarn'].clear
 | 
			
		||||
 | 
			
		||||
namespace :webpacker do
 | 
			
		||||
  desc 'Verifies if Yarn is installed'
 | 
			
		||||
  task check_yarn: :environment do
 | 
			
		||||
    begin
 | 
			
		||||
      yarn_version = `yarn --version`.strip
 | 
			
		||||
      raise Errno::ENOENT if yarn_version.blank?
 | 
			
		||||
 | 
			
		||||
      yarn_range = '>=4 <5'
 | 
			
		||||
      is_valid = begin
 | 
			
		||||
        SemanticRange.satisfies?(yarn_version, yarn_range)
 | 
			
		||||
      rescue
 | 
			
		||||
        false
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      unless is_valid
 | 
			
		||||
        warn "Mastodon and Webpacker requires Yarn \"#{yarn_range}\" and you are using #{yarn_version}"
 | 
			
		||||
        warn 'Exiting!'
 | 
			
		||||
        exit!
 | 
			
		||||
      end
 | 
			
		||||
    rescue Errno::ENOENT
 | 
			
		||||
      warn 'Yarn not installed. Please see the Mastodon documentation to install the correct version.'
 | 
			
		||||
      warn 'Exiting!'
 | 
			
		||||
      exit!
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
		Reference in New Issue
	
	Block a user