Fix release script to publish the ujs package

This commit is contained in:
Rafael Mendonça França 2023-05-24 19:22:19 +00:00
parent 23243eb283
commit ad9037aab8
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
1 changed files with 3 additions and 1 deletions

View File

@ -16,6 +16,8 @@ FRAMEWORKS = %w(
railties
)
FRAMEWORK_NAMES = Hash.new { |h, k| k.split(/(?<=active|action)/).map(&:capitalize).join(" ") }
NPM_PACKAGES = { "actionview" => "ujs" }
NPM_PACKAGES.default_proc = -> (_, framework) { framework }
root = File.expand_path("..", __dir__)
version = File.read("#{root}/RAILS_VERSION").strip
@ -121,7 +123,7 @@ npm_version = version.gsub(/\./).with_index { |s, i| i >= 2 ? "-" : s }
if /[a-z]/.match?(version)
npm_tag = " --tag pre"
else
remote_package_version = `npm view @rails/#{framework}@latest version`.chomp
remote_package_version = `npm view @rails/#{NPM_PACKAGES[framework]}@latest version`.chomp
local_major_version = version.split(".", 4)[0]
remote_major_version = remote_package_version.split(".", 4)[0]
npm_tag = remote_major_version <= local_major_version ? " --tag latest" : " --tag v#{local_major_version}"