Sha256: bceacdb97c2d445320b0df4b7c70f863eb7212010b535bcce941d57678078f45

Contents?: true

Size: 886 Bytes

Versions: 1

Compression:

Stored size: 886 Bytes

Contents

say "Create controllers directory"
empty_directory "app/javascript/controllers"
copy_file "#{__dir__}/app/javascript/controllers/index_for_node.js",
  "app/javascript/controllers/index.js"
copy_file "#{__dir__}/app/javascript/controllers/application.js",
  "app/javascript/controllers/application.js"
copy_file "#{__dir__}/app/javascript/controllers/hello_controller.js",
  "app/javascript/controllers/hello_controller.js"

if (Rails.root.join("app/javascript/application.js")).exist?
  say "Import Stimulus controllers"
  append_to_file "app/javascript/application.js", %(import "./controllers"\n)
else
  say %(Couldn't find "app/javascript/application.js".\nYou must import "./controllers" in your JavaScript entrypoint file), :red
end

say "Install Stimulus"
if Rails.root.join("bun.config.js")).exist?
  run "bun add @hotwired/stimulus"
else
  run "yarn add @hotwired/stimulus"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stimulus-rails-1.3.2 lib/install/stimulus_with_node.rb