stimulus-rails 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f77f2ce48a99dfbc61800f5898cc71aecb3d6886fec0e4f65b64c1c7f772f87d
4
- data.tar.gz: 219f51744c6f6e532bb68b474575307f18f1c348520fe157b8cacdf960b48f81
3
+ metadata.gz: 137cfce6bd7f22e364b007518b204f8d4f910190e9aa3eb02325bc72df4126a3
4
+ data.tar.gz: fbdfaa35d93547b47c7a1ec9beb41ce55f5b513db29a5e94c66c3de639fa9834
5
5
  SHA512:
6
- metadata.gz: e6e4099ab2741482ea33c260257e9898afa9fbb9e465072d659b96f5ac63d4aceb7355439a8e3db46b7dd06a0ec7b2f6d9973997fd3a0016f011b7f4b6badf91
7
- data.tar.gz: 0d9269cf9234266aba718e0ddc0ddc680773d73f107f76bbf5529758321db4ebb020814f3a27c217a8b0538d08145c2c861afe304765ce295081a670e593b647
6
+ metadata.gz: 3d72a10a00514a1c3dc0466f653fc9f40ebe8044ab11d3b8d4704e3e56dde8bd9d9733d25634206adeef373a4c5fae8abd2b44e1a458e16969981073889de781
7
+ data.tar.gz: b8f826cd66e344b302f893d88659471cd503b63a530613cd6fa03ce7697dc9060d2b7f8f2ed23b1123baf5f0cb7ddd3f833472f6591116f4c7ac74f53c5d8007
@@ -1,20 +1,27 @@
1
- APP_JS_ROOT = Rails.root.join("app/assets/javascripts")
1
+ APP_JS_ROOT = Rails.root.join("app/javascript")
2
+ APP_JS_PATH = APP_JS_ROOT.join("application.js")
2
3
  IMPORTMAP_PATH = Rails.root.join("config/initializers/importmap.rb")
3
4
 
4
- say "Import Stimulus autoloader in existing app/assets/javascripts/application.js"
5
- append_to_file APP_JS_ROOT.join("application.js"), %(\nimport "@hotwired/stimulus-autoloader"\n)
5
+ if APP_JS_PATH.exist?
6
+ say "Import Stimulus autoloader in existing app/javascript/application.js"
7
+ append_to_file APP_JS_PATH, %(\nimport "@hotwired/stimulus-autoloader"\n)
8
+ else
9
+ say <<~INSTRUCTIONS, :red
10
+ You must import @hotwire/stimulus and @hotwire/stimulus-importmap-autoloader in your application.js.
11
+ INSTRUCTIONS
12
+ end
6
13
 
7
14
  say "Creating controllers directory"
8
- copy_file "#{__dir__}/app/assets/javascripts/controllers/hello_controller.js", APP_JS_ROOT.join("controllers/hello_controller.js")
15
+ copy_file "#{__dir__}/app/javascript/controllers/hello_controller.js", APP_JS_ROOT.join("controllers/hello_controller.js")
9
16
 
10
17
  if IMPORTMAP_PATH.exist?
11
- say "Pin @hotwired/stimulus and @hotwired/stimulus-autoloader in config/initializers/importmap.rb"
18
+ say "Pin @hotwired/stimulus and @hotwired/stimulus-importmap-autoloader in config/initializers/importmap.rb"
12
19
  insert_into_file \
13
20
  IMPORTMAP_PATH.to_s,
14
- %( pin "@hotwired/stimulus", to: "stimulus.js"\n pin "@hotwired/stimulus-autoloader", to: "stimulus-autoloader.js"\n\n),
21
+ %( pin "@hotwired/stimulus", to: "stimulus.js"\n pin "@hotwired/stimulus-importmap-autoloader", to: "stimulus-importmap-autoloader.js"\n\n),
15
22
  after: "Rails.application.config.importmap.draw do\n"
16
23
  else
17
- say <<~INSTRUCTIONS, :green
24
+ say <<~INSTRUCTIONS, :red
18
25
  You must add @rails/actiontext and trix to your importmap to reference them via ESM.
19
26
  INSTRUCTIONS
20
27
  end
@@ -2,7 +2,7 @@ say "Appending Stimulus setup code to #{Webpacker.config.source_entry_path}/appl
2
2
  append_to_file "#{Webpacker.config.source_entry_path}/application.js", %(\nimport "controllers")
3
3
 
4
4
  say "Creating controllers directory"
5
- directory "#{__dir__}/app/assets/javascripts/controllers", "#{Webpacker.config.source_path}/controllers"
5
+ directory "#{__dir__}/app/javascript/controllers", "#{Webpacker.config.source_path}/controllers"
6
6
 
7
7
  say "Using Stimulus NPM package"
8
8
  gsub_file "#{Webpacker.config.source_path}/controllers/hello_controller.js", /@hotwired\//, ''
@@ -1,3 +1,3 @@
1
1
  module Stimulus
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulus-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stephenson
@@ -39,8 +39,8 @@ files:
39
39
  - app/assets/javascripts/stimulus-importmap-autoloader.js
40
40
  - app/assets/javascripts/stimulus.js
41
41
  - app/assets/javascripts/stimulus@2.js
42
- - lib/install/app/assets/javascripts/controllers/hello_controller.js
43
- - lib/install/app/assets/javascripts/controllers/index.js
42
+ - lib/install/app/javascript/controllers/hello_controller.js
43
+ - lib/install/app/javascript/controllers/index.js
44
44
  - lib/install/stimulus_with_asset_pipeline.rb
45
45
  - lib/install/stimulus_with_webpacker.rb
46
46
  - lib/stimulus-rails.rb