voidable-hotwire 0.6.0 → 0.7.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 64213f6a889487e4b5847bd5460791fa641009c2d24f848a5abc4c905c94b93b
|
|
4
|
+
data.tar.gz: 7659fd6e398f7844536a6ea355206afdcf4d29d9ff2a804c1275e3176e127405
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: abf7e3352ce595eec8041d4cfdbf6b9de49efb43cd645e564399e388be68426631a3e2f80c2a09ac32670cc367cddad5864d0915544303eb2aff063cb8ea23f3
|
|
7
|
+
data.tar.gz: bea1ceac3fb0bf644181e3c70188b2fec07429379fe968f44b537b3eb24151d9bdc065b91f9a7154cec8faab7f7e1fc665a1dbf713759ef637b4fea2d5c527bb
|
|
@@ -145,9 +145,34 @@ module Voidable
|
|
|
145
145
|
imports += "\nimport \"./voidable-layout.js\";"
|
|
146
146
|
append_to_file js_entrypoint, "\n#{imports}\n"
|
|
147
147
|
end
|
|
148
|
+
if vite? && !contents.include?("VoidEventController")
|
|
149
|
+
append_to_file js_entrypoint, <<~JS
|
|
150
|
+
|
|
151
|
+
import { VoidEventController, VoidTurbo } from "@voidable/ui-hotwire";
|
|
152
|
+
const app = Application.start();
|
|
153
|
+
app.register("void-event", VoidEventController);
|
|
154
|
+
VoidTurbo.start();
|
|
155
|
+
JS
|
|
156
|
+
end
|
|
148
157
|
say "Added Voidable imports to application.js", :green
|
|
149
158
|
end
|
|
150
159
|
|
|
160
|
+
def wire_stimulus_controllers
|
|
161
|
+
return if vite?
|
|
162
|
+
controllers_js = "app/javascript/controllers/application.js"
|
|
163
|
+
return unless File.exist?(controllers_js)
|
|
164
|
+
return if File.read(controllers_js).include?("VoidEventController")
|
|
165
|
+
inject_into_file controllers_js, after: /window\.Stimulus\s*=\s*application\n/ do
|
|
166
|
+
<<~JS
|
|
167
|
+
|
|
168
|
+
import { VoidEventController, VoidTurbo } from "@voidable/ui-hotwire"
|
|
169
|
+
application.register("void-event", VoidEventController)
|
|
170
|
+
VoidTurbo.start()
|
|
171
|
+
JS
|
|
172
|
+
end
|
|
173
|
+
say "Registered VoidEventController and started VoidTurbo in controllers/application.js", :green
|
|
174
|
+
end
|
|
175
|
+
|
|
151
176
|
def create_vite_helper
|
|
152
177
|
return unless vite?
|
|
153
178
|
template "vite_helper.rb.tt", "app/helpers/vite_helper.rb"
|
|
@@ -185,6 +210,12 @@ module Voidable
|
|
|
185
210
|
say "", :yellow
|
|
186
211
|
end
|
|
187
212
|
end
|
|
213
|
+
|
|
214
|
+
def install_active_storage
|
|
215
|
+
return if File.exist?("db/migrate") && Dir.glob("db/migrate/*active_storage*").any?
|
|
216
|
+
rails_command "active_storage:install"
|
|
217
|
+
say "Installed Active Storage migrations (run `bin/rails db:migrate` to apply)", :green
|
|
218
|
+
end
|
|
188
219
|
end
|
|
189
220
|
end
|
|
190
221
|
end
|