Create update yarn task (#39314)
* Use app:binstub:yarn in Action Text install generator
This commit is contained in:
parent
12bfc8d9a6
commit
98a3644be0
|
@ -9,10 +9,10 @@ module ActionText
|
|||
source_root File.expand_path("templates", __dir__)
|
||||
|
||||
def install_javascript_dependencies
|
||||
rails_command "app:update:bin", inline: true
|
||||
rails_command "app:binstub:yarn", inline: true
|
||||
|
||||
say "Installing JavaScript dependencies", :green
|
||||
run "yarn add #{js_dependencies.map { |name, version| "#{name}@#{version}" }.join(" ")}",
|
||||
run "bin/yarn add #{js_dependencies.map { |name, version| "#{name}@#{version}" }.join(" ")}",
|
||||
abort_on_failure: true, capture: true
|
||||
end
|
||||
|
||||
|
|
|
@ -100,6 +100,16 @@ module Rails
|
|||
end
|
||||
end
|
||||
|
||||
def yarn_when_updating
|
||||
return if File.exist?("bin/yarn")
|
||||
|
||||
template "bin/yarn" do |content|
|
||||
"#{shebang}\n" + content
|
||||
end
|
||||
|
||||
chmod "bin", 0755 & ~File.umask, verbose: false
|
||||
end
|
||||
|
||||
def config
|
||||
empty_directory "config"
|
||||
|
||||
|
@ -314,6 +324,11 @@ module Rails
|
|||
end
|
||||
remove_task :update_bin_files
|
||||
|
||||
def update_bin_yarn
|
||||
build(:yarn_when_updating)
|
||||
end
|
||||
remove_task :update_bin_yarn
|
||||
|
||||
def update_active_storage
|
||||
unless skip_active_storage?
|
||||
rails_command "active_storage:update", inline: true
|
||||
|
|
|
@ -59,4 +59,10 @@ namespace :app do
|
|||
Rails::AppUpdater.invoke_from_app_generator :display_upgrade_guide_info
|
||||
end
|
||||
end
|
||||
|
||||
namespace :binstub do
|
||||
task :yarn do
|
||||
Rails::AppUpdater.invoke_from_app_generator :update_bin_yarn
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue