Class: Alchemy::Upgrader::SevenPointZero
- Inherits:
-
Alchemy::Upgrader
- Object
- Alchemy::Upgrader
- Alchemy::Upgrader::SevenPointZero
- Includes:
- Thor::Actions, Thor::Base
- Defined in:
- lib/alchemy/upgrader/seven_point_zero.rb
Constant Summary
Constants included from Shell
Class Method Summary collapse
Methods inherited from Alchemy::Upgrader
copy_new_config_file, update_npm_package
Methods included from Shell
#add_todo, #desc, #display_todos, #log, silence!, silenced?, #todo, #todos, verbose!
Class Method Details
.update_admin_entrypoint ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/alchemy/upgrader/seven_point_zero.rb', line 11 def update_admin_entrypoint if File.exist? "app/javascript/packs/alchemy/admin.js" FileUtils.mv "app/javascript/packs/alchemy/admin.js", "app/javascript/alchemy_admin.js" else log "Skipping. No alchemy/admin entrypoint found. Maybe already migrated from Webpacker?", :info end if Dir.exist?("app/javascript/packs/alchemy") && Dir.empty?("app/javascript/packs/alchemy") FileUtils.rm_r "app/javascript/packs/alchemy" end if File.exist? "config/importmap.rb" # We want the bundled package if using importmaps task.gsub_file "app/javascript/alchemy_admin.js", 'import "@alchemy_cms/admin"', 'import "@alchemy_cms/dist/admin"' end if task.ask("Do you want to remove webpacker now? (y/N)", default: "N") == "y" task.run "yarn remove @rails/webpacker webpack webpack-cli webpack-dev-server" FileUtils.rm_r "app/javascript/packs" FileUtils.rm_r "config/webpack" FileUtils.rm "config/webpacker.yml" FileUtils.rm "bin/webpack" FileUtils.rm "bin/webpack-dev-server" end if task.ask("Do you want to add jsbundling-rails now? (Y/n)", default: "Y") == "Y" task.run "bundle add jsbundling-rails" task.run "bin/rails javascript:install:esbuild" end end |