0
0
Fork 0

Upgrade to Yarn 4, remove support for Node 16 (#27073)

This commit is contained in:
Renaud Chaput 2023-11-08 11:57:21 +01:00 committed by GitHub
parent 23e32a4b30
commit 757d7c73c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 17954 additions and 13021 deletions

34
lib/tasks/webpacker.rake Normal file
View file

@ -0,0 +1,34 @@
# 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