mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Create update yarn task (#39314)
* Use app:binstub:yarn in Action Text install generator
This commit is contained in:
parent
12bfc8d9a6
commit
98a3644be0
3 changed files with 23 additions and 2 deletions
|
@ -9,10 +9,10 @@ module ActionText
|
||||||
source_root File.expand_path("templates", __dir__)
|
source_root File.expand_path("templates", __dir__)
|
||||||
|
|
||||||
def install_javascript_dependencies
|
def install_javascript_dependencies
|
||||||
rails_command "app:update:bin", inline: true
|
rails_command "app:binstub:yarn", inline: true
|
||||||
|
|
||||||
say "Installing JavaScript dependencies", :green
|
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
|
abort_on_failure: true, capture: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,16 @@ module Rails
|
||||||
end
|
end
|
||||||
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
|
def config
|
||||||
empty_directory "config"
|
empty_directory "config"
|
||||||
|
|
||||||
|
@ -314,6 +324,11 @@ module Rails
|
||||||
end
|
end
|
||||||
remove_task :update_bin_files
|
remove_task :update_bin_files
|
||||||
|
|
||||||
|
def update_bin_yarn
|
||||||
|
build(:yarn_when_updating)
|
||||||
|
end
|
||||||
|
remove_task :update_bin_yarn
|
||||||
|
|
||||||
def update_active_storage
|
def update_active_storage
|
||||||
unless skip_active_storage?
|
unless skip_active_storage?
|
||||||
rails_command "active_storage:update", inline: true
|
rails_command "active_storage:update", inline: true
|
||||||
|
|
|
@ -59,4 +59,10 @@ namespace :app do
|
||||||
Rails::AppUpdater.invoke_from_app_generator :display_upgrade_guide_info
|
Rails::AppUpdater.invoke_from_app_generator :display_upgrade_guide_info
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
namespace :binstub do
|
||||||
|
task :yarn do
|
||||||
|
Rails::AppUpdater.invoke_from_app_generator :update_bin_yarn
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue