stimulus-rails 1.3.0 → 1.3.2

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: c89b0f73a5f7933de25b0656cb2c82c916c05eef10141152bf2e3f21806c4425
4
- data.tar.gz: b8d71e42951d906da9c8ec5aa3e7db501baec6f9b0e1c793a1e476394b00d246
3
+ metadata.gz: 26b4c5a3a8ad8343e36257e5dadadb2a455638b563e778cb3c91c2f6eb711f45
4
+ data.tar.gz: 3cf5b9afc555a09d520622390b3acf67c5c5da746c1e2a79380a2100269e6966
5
5
  SHA512:
6
- metadata.gz: a0299ff4d4b41706c1a07fbcca3342ec4ff88c5198ff5c24e5204fc34487c7a78b9ad844173bda7ef42e740ff4fb46fc83a59739fe456d58d80c90e0091e7b0e
7
- data.tar.gz: acc3c4f0989139464e77e9308904b39dfe2b60058c71cb1c17a310a68f22b259b98f5ae511a42a9c614f0ffa059bac454d9dc870efb4aa79af4f7e003779f01c
6
+ metadata.gz: caf8589004d8e06afc3bc0faef28c38052353bb468702690c3166ad12ca5c8e2ab8c3e46c6c851d2211f244cf9e0869985d929f6363b705b1f281f765d062bd9
7
+ data.tar.gz: f046788a1b1523cd34da3303c8bb5b010173a9db9778509b36d67b671ba2d9181e748358feba6a05e390e0993f3107d16e9a2db46685556d1b7ccf3557c68da3
data/README.md CHANGED
@@ -57,8 +57,8 @@ import "controllers"
57
57
 
58
58
  6. Finally, Pin Stimulus and controllers in `config/importmap.rb` by adding:
59
59
  ```ruby
60
- pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
61
- pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
60
+ pin "@hotwired/stimulus", to: "stimulus.min.js"
61
+ pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
62
62
  pin_all_from "app/javascript/controllers", under: "controllers"
63
63
 
64
64
  ```
@@ -11,11 +11,11 @@ say "Import Stimulus controllers"
11
11
  append_to_file "app/javascript/application.js", %(import "controllers"\n)
12
12
 
13
13
  say "Pin Stimulus"
14
- say %(Appending: pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true")
15
- append_to_file "config/importmap.rb", %(pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true\n)
14
+ say %(Appending: pin "@hotwired/stimulus", to: "stimulus.min.js")
15
+ append_to_file "config/importmap.rb", %(pin "@hotwired/stimulus", to: "stimulus.min.js"\n)
16
16
 
17
- say %(Appending: pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true)
18
- append_to_file "config/importmap.rb", %(pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true\n)
17
+ say %(Appending: pin "@hotwired/stimulus-loading", to: "stimulus-loading.js")
18
+ append_to_file "config/importmap.rb", %(pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"\n)
19
19
 
20
20
  say "Pin all controllers"
21
21
  say %(Appending: pin_all_from "app/javascript/controllers", under: "controllers")
@@ -15,4 +15,8 @@ else
15
15
  end
16
16
 
17
17
  say "Install Stimulus"
18
- run "yarn add @hotwired/stimulus"
18
+ if Rails.root.join("bun.config.js")).exist?
19
+ run "bun add @hotwired/stimulus"
20
+ else
21
+ run "yarn add @hotwired/stimulus"
22
+ end
@@ -2,15 +2,17 @@ module Stimulus::Manifest
2
2
  extend self
3
3
 
4
4
  def generate_from(controllers_path)
5
- extract_controllers_from(controllers_path).collect do |controller_path|
5
+ manifest = extract_controllers_from(controllers_path).collect do |controller_path|
6
6
  import_and_register_controller(controllers_path, controller_path)
7
7
  end
8
+
9
+ manifest.uniq
8
10
  end
9
11
 
10
12
  def import_and_register_controller(controllers_path, controller_path)
11
13
  controller_path = controller_path.relative_path_from(controllers_path).to_s
12
14
  module_path = controller_path.split('.').first
13
- controller_class_name = module_path.camelize.gsub(/::/, "__")
15
+ controller_class_name = module_path.underscore.camelize.gsub(/::/, "__")
14
16
  tag_name = module_path.remove(/_controller/).gsub(/_/, "-").gsub(/\//, "--")
15
17
 
16
18
  <<-JS
@@ -1,3 +1,3 @@
1
1
  module Stimulus
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.2"
3
3
  end
@@ -45,10 +45,12 @@ namespace :stimulus do
45
45
  end
46
46
 
47
47
  namespace :manifest do
48
+ desc "Show the current Stimulus manifest (all installed controllers)"
48
49
  task :display do
49
50
  puts Stimulus::Manifest.generate_from(Rails.root.join("app/javascript/controllers"))
50
51
  end
51
52
 
53
+ desc "Update the Stimulus manifest (will overwrite controllers/index.js)"
52
54
  task :update do
53
55
  manifest =
54
56
  Stimulus::Manifest.generate_from(Rails.root.join("app/javascript/controllers"))
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: 1.3.0
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stephenson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-10-11 00:00:00.000000000 Z
13
+ date: 2024-01-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  requirements: []
80
- rubygems_version: 3.4.15
80
+ rubygems_version: 3.4.14
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: A modest JavaScript framework for the HTML you already have.