stimulus_reflex 3.5.0.rc2 → 3.5.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of stimulus_reflex might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +21 -18
- data/app/assets/javascripts/stimulus_reflex.js +3 -3
- data/app/assets/javascripts/stimulus_reflex.umd.js +3 -3
- data/app/channels/stimulus_reflex/channel.rb +1 -1
- data/lib/generators/stimulus_reflex/stimulus_reflex_generator.rb +6 -18
- data/lib/generators/stimulus_reflex/templates/app/javascript/config/cable_ready.js.tt +6 -2
- data/lib/generators/stimulus_reflex/templates/app/javascript/config/index.js.tt +7 -2
- data/lib/generators/stimulus_reflex/templates/app/javascript/config/stimulus_reflex.js.tt +5 -0
- data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/%file_name%_controller.js.tt +6 -2
- data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/application.js.tt +5 -1
- data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.importmap.tt +7 -1
- data/lib/install/config.rb +5 -5
- data/lib/install/esbuild.rb +1 -1
- data/lib/install/importmap.rb +2 -2
- data/lib/install/mrujs.rb +10 -5
- data/lib/install/npm_packages.rb +1 -1
- data/lib/install/shakapacker.rb +1 -1
- data/lib/install/vite.rb +1 -1
- data/lib/install/webpacker.rb +1 -1
- data/lib/install/yarn.rb +3 -3
- data/lib/stimulus_reflex/cable_readiness.rb +1 -7
- data/lib/stimulus_reflex/installer.rb +88 -7
- data/lib/stimulus_reflex/version.rb +1 -1
- data/lib/tasks/stimulus_reflex/stimulus_reflex.rake +21 -52
- data/package.json +3 -3
- data/stimulus_reflex.gemspec +1 -1
- data/yarn.lock +500 -440
- metadata +7 -7
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "stimulus_reflex/installer"
|
4
|
+
|
3
5
|
SR_STEPS = {
|
4
6
|
"action_cable" => "Action Cable",
|
5
7
|
"webpacker" => "Install StimulusReflex using Webpacker",
|
@@ -51,17 +53,18 @@ end
|
|
51
53
|
namespace :stimulus_reflex do
|
52
54
|
desc "✨ Install StimulusReflex and CableReady ✨"
|
53
55
|
task :install do
|
54
|
-
|
55
|
-
|
56
|
+
create_dir_if_not_exists(Rails.root.join("tmp/stimulus_reflex_installer/templates"))
|
57
|
+
create_dir_if_not_exists(Rails.root.join("tmp/stimulus_reflex_installer/working"))
|
58
|
+
|
56
59
|
install_complete = Rails.root.join("tmp/stimulus_reflex_installer/complete")
|
57
60
|
|
58
|
-
|
61
|
+
used_bundler = nil
|
59
62
|
options = {}
|
60
63
|
|
61
64
|
ARGV.each do |arg|
|
62
65
|
# make sure we have a valid build tool specified, or proceed to automatic detection
|
63
66
|
if ["webpacker", "esbuild", "vite", "shakapacker", "importmap"].include?(arg)
|
64
|
-
|
67
|
+
used_bundler = arg
|
65
68
|
else
|
66
69
|
kv = arg.split("=")
|
67
70
|
if kv.length == 2
|
@@ -90,9 +93,9 @@ namespace :stimulus_reflex do
|
|
90
93
|
end
|
91
94
|
|
92
95
|
# if there is an installation in progress, continue where we left off
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
+
if installer_entrypoint_path.exist?
|
97
|
+
entrypoint = installer_entrypoint_path.read
|
98
|
+
|
96
99
|
puts "✨ Resuming \e[38;5;220mStimulusReflex\e[0m and \e[38;5;220mCableReady\e[0m installation ✨"
|
97
100
|
puts
|
98
101
|
puts "If you have any setup issues, please consult \e[4;97mhttps://docs.stimulusreflex.com/hello-world/setup\e[0m"
|
@@ -106,69 +109,35 @@ namespace :stimulus_reflex do
|
|
106
109
|
puts
|
107
110
|
puts "If you have any setup issues, please consult \e[4;97mhttps://docs.stimulusreflex.com/hello-world/setup\e[0m"
|
108
111
|
puts "or get help on Discord: \e[4;97mhttps://discord.gg/stimulus-reflex\e[0m. \e[38;5;196mWe are here for you.\e[0m 💙"
|
112
|
+
|
109
113
|
if Rails.root.join(".git").exist?
|
110
114
|
puts
|
111
115
|
puts "We recommend running \e[1;94mgit commit\e[0m before proceeding. A diff will be generated at the end."
|
112
116
|
end
|
113
117
|
|
114
|
-
if options.key? "entrypoint"
|
115
|
-
|
118
|
+
entrypoint = if options.key? "entrypoint"
|
119
|
+
options["entrypoint"]
|
116
120
|
else
|
117
|
-
|
118
|
-
"app/javascript",
|
119
|
-
"app/frontend"
|
120
|
-
].find { |path| File.exist?(Rails.root.join(path)) } || "app/javascript"
|
121
|
-
|
122
|
-
puts
|
123
|
-
puts "Where do JavaScript files live in your app? Our best guess is: \e[1m#{entrypoint}\e[22m 🤔"
|
124
|
-
puts "Press enter to accept this, or type a different path."
|
125
|
-
print "> "
|
126
|
-
input = $stdin.gets.chomp
|
127
|
-
entrypoint = input unless input.blank?
|
121
|
+
auto_detect_entrypoint
|
128
122
|
end
|
129
|
-
|
123
|
+
|
124
|
+
installer_entrypoint_path.write(entrypoint)
|
130
125
|
end
|
131
126
|
|
132
127
|
# verify their bundler before starting, unless they explicitly specified on CLI
|
133
|
-
if !
|
134
|
-
|
135
|
-
if Rails.root.join("config/importmap.rb").exist?
|
136
|
-
bundler = "importmap"
|
137
|
-
elsif Rails.root.join("package.json").exist?
|
138
|
-
package_json = File.read(Rails.root.join("package.json"))
|
139
|
-
bundler = "webpacker" if package_json.include?('"@rails/webpacker":')
|
140
|
-
bundler = "esbuild" if package_json.include?('"esbuild":')
|
141
|
-
bundler = "vite" if package_json.include?('"vite":')
|
142
|
-
bundler = "shakapacker" if package_json.include?('"shakapacker":')
|
143
|
-
if !bundler
|
144
|
-
puts "❌ You must be using a node-based bundler such as esbuild, webpacker, vite or shakapacker (package.json) or importmap (config/importmap.rb) to use StimulusReflex."
|
145
|
-
exit
|
146
|
-
end
|
147
|
-
else
|
148
|
-
puts "❌ You must be using a node-based bundler such as esbuild, webpacker, vite or shakapacker (package.json) or importmap (config/importmap.rb) to use StimulusReflex."
|
149
|
-
exit
|
150
|
-
end
|
151
|
-
|
152
|
-
puts
|
153
|
-
puts "It looks like you're using \e[1m#{bundler}\e[22m as your bundler. Is that correct? (Y/n)"
|
154
|
-
print "> "
|
155
|
-
input = $stdin.gets.chomp
|
156
|
-
if input.downcase == "n"
|
157
|
-
puts
|
158
|
-
puts "StimulusReflex installation supports: esbuild, webpacker, vite, shakapacker and importmap."
|
159
|
-
puts "Please run \e[1;94mrails stimulus_reflex:install [bundler]\e[0m to install StimulusReflex and CableReady."
|
160
|
-
exit
|
161
|
-
end
|
128
|
+
if !used_bundler
|
129
|
+
used_bundler = bundler
|
162
130
|
end
|
163
131
|
|
164
|
-
|
132
|
+
installer_bundler_path.write(used_bundler)
|
133
|
+
|
165
134
|
FileUtils.touch("tmp/stimulus_reflex_installer/backups")
|
166
135
|
File.write("tmp/stimulus_reflex_installer/template_src", File.expand_path("../../generators/stimulus_reflex/templates/", __dir__))
|
167
136
|
|
168
137
|
`bin/spring stop` if defined?(Spring)
|
169
138
|
|
170
139
|
# do the things
|
171
|
-
SR_BUNDLERS[
|
140
|
+
SR_BUNDLERS[used_bundler].each do |template|
|
172
141
|
run_install_template(template, trace: !!options["trace"])
|
173
142
|
end
|
174
143
|
|
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "stimulus_reflex",
|
3
|
-
"version": "3.5.0-
|
3
|
+
"version": "3.5.0-rc3",
|
4
4
|
"description": "Build reactive applications with the Rails tooling you already know and love.",
|
5
5
|
"keywords": [
|
6
6
|
"ruby",
|
@@ -57,7 +57,7 @@
|
|
57
57
|
"dependencies": {
|
58
58
|
"@hotwired/stimulus": "^3",
|
59
59
|
"@rails/actioncable": "^6 || ^7",
|
60
|
-
"cable_ready": "5.0.0
|
60
|
+
"cable_ready": "^5.0.0"
|
61
61
|
},
|
62
62
|
"devDependencies": {
|
63
63
|
"@open-wc/testing": "^3.1.7",
|
@@ -70,6 +70,6 @@
|
|
70
70
|
"prettier-standard": "^16.4.1",
|
71
71
|
"rollup": "^3.19.1",
|
72
72
|
"toastify-js": "^1.12.0",
|
73
|
-
"vitepress": "^1.0.0-
|
73
|
+
"vitepress": "^1.0.0-beta.1"
|
74
74
|
}
|
75
75
|
}
|
data/stimulus_reflex.gemspec
CHANGED
@@ -46,7 +46,7 @@ Gem::Specification.new do |gem|
|
|
46
46
|
gem.add_dependency "activesupport", *rails_version
|
47
47
|
gem.add_dependency "railties", *rails_version
|
48
48
|
|
49
|
-
gem.add_dependency "cable_ready", "
|
49
|
+
gem.add_dependency "cable_ready", "~> 5.0"
|
50
50
|
gem.add_dependency "nokogiri", "~> 1.0"
|
51
51
|
gem.add_dependency "rack", ">= 2", "< 4"
|
52
52
|
gem.add_dependency "redis", ">= 4.0", "< 6.0"
|