stimulus_reflex 3.5.0.rc4 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +19 -13
  3. data/app/assets/javascripts/stimulus_reflex.js +1 -1
  4. data/app/assets/javascripts/stimulus_reflex.umd.js +1 -1
  5. data/lib/generators/stimulus_reflex/stimulus_reflex_generator.rb +2 -2
  6. data/lib/generators/stimulus_reflex/templates/app/javascript/config/cable_ready.js.tt +1 -1
  7. data/lib/generators/stimulus_reflex/templates/app/javascript/config/index.js.tt +1 -1
  8. data/lib/generators/stimulus_reflex/templates/app/javascript/config/stimulus_reflex.js.tt +1 -1
  9. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/%file_name%_controller.js.tt +1 -1
  10. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/application.js.tt +1 -1
  11. data/lib/install/action_cable.rb +30 -30
  12. data/lib/install/broadcaster.rb +11 -11
  13. data/lib/install/bundle.rb +9 -9
  14. data/lib/install/compression.rb +5 -5
  15. data/lib/install/config.rb +22 -22
  16. data/lib/install/development.rb +19 -19
  17. data/lib/install/esbuild.rb +28 -28
  18. data/lib/install/example.rb +3 -3
  19. data/lib/install/importmap.rb +29 -29
  20. data/lib/install/initializers.rb +3 -3
  21. data/lib/install/mrujs.rb +25 -25
  22. data/lib/install/npm_packages.rb +7 -7
  23. data/lib/install/reflexes.rb +2 -2
  24. data/lib/install/shakapacker.rb +23 -23
  25. data/lib/install/spring.rb +7 -7
  26. data/lib/install/updatable.rb +7 -7
  27. data/lib/install/vite.rb +22 -22
  28. data/lib/install/webpacker.rb +27 -27
  29. data/lib/install/yarn.rb +9 -9
  30. data/lib/stimulus_reflex/html/document_fragment.rb +5 -3
  31. data/lib/stimulus_reflex/installer.rb +303 -277
  32. data/lib/stimulus_reflex/version.rb +1 -1
  33. data/lib/stimulus_reflex.rb +2 -0
  34. data/lib/tasks/stimulus_reflex/stimulus_reflex.rake +8 -8
  35. data/package.json +1 -1
  36. data/stimulus_reflex.gemspec +2 -0
  37. data/yarn.lock +7 -7
  38. metadata +30 -2
@@ -2,28 +2,28 @@
2
2
 
3
3
  require "stimulus_reflex/installer"
4
4
 
5
- return if pack_path_missing?
5
+ return if StimulusReflex::Installer.pack_path_missing?
6
6
 
7
7
  # verify that all critical dependencies are up to date; if not, queue for later
8
- lines = package_json_path.readlines
8
+ lines = StimulusReflex::Installer.package_json_path.readlines
9
9
 
10
10
  if !lines.index { |line| line =~ /^\s*["']@hotwired\/stimulus-webpack-helpers["']: ["']\^1.0.1["']/ }
11
- add_package "@hotwired/stimulus-webpack-helpers@^1.0.1"
11
+ StimulusReflex::Installer.add_package "@hotwired/stimulus-webpack-helpers@^1.0.1"
12
12
  else
13
13
  say "⏩ @hotwired/stimulus-webpack-helpers npm package is already present. Skipping."
14
14
  end
15
15
 
16
16
  step_path = "/app/javascript/controllers/"
17
- # controller_templates_path = File.expand_path(template_src + "/app/javascript/controllers", File.join(File.dirname(__FILE__)))
18
- application_controller_src = fetch(step_path, "application_controller.js.tt")
19
- application_controller_path = controllers_path / "application_controller.js"
20
- application_js_src = fetch(step_path, "application.js.tt")
21
- application_js_path = controllers_path / "application.js"
22
- index_src = fetch(step_path, "index.js.shakapacker.tt")
23
- index_path = controllers_path / "index.js"
17
+ # controller_templates_path = File.expand_path(StimulusReflex::Installer.template_src + "/app/javascript/controllers", File.join(File.dirname(__FILE__)))
18
+ application_controller_src = StimulusReflex::Installer.fetch(step_path, "application_controller.js.tt")
19
+ application_controller_path = StimulusReflex::Installer.controllers_path / "application_controller.js"
20
+ application_js_src = StimulusReflex::Installer.fetch(step_path, "application.js.tt")
21
+ application_js_path = StimulusReflex::Installer.controllers_path / "application.js"
22
+ index_src = StimulusReflex::Installer.fetch(step_path, "index.js.shakapacker.tt")
23
+ index_path = StimulusReflex::Installer.controllers_path / "index.js"
24
24
 
25
25
  # create entrypoint/controllers, as well as the index, application and application_controller
26
- empty_directory controllers_path unless controllers_path.exist?
26
+ empty_directory StimulusReflex::Installer.controllers_path unless StimulusReflex::Installer.controllers_path.exist?
27
27
 
28
28
  copy_file(application_controller_src, application_controller_path) unless application_controller_path.exist?
29
29
  copy_file(application_js_src, application_js_path) unless application_js_path.exist?
@@ -32,33 +32,33 @@ copy_file(index_src, index_path) unless index_path.exist?
32
32
  controllers_pattern = /import ['"]controllers['"]/
33
33
  controllers_commented_pattern = /\s*\/\/\s*#{controllers_pattern}/
34
34
 
35
- if pack.match?(controllers_pattern)
36
- if pack.match?(controllers_commented_pattern)
37
- proceed = if options.key? "uncomment"
38
- options["uncomment"]
35
+ if StimulusReflex::Installer.pack.match?(controllers_pattern)
36
+ if StimulusReflex::Installer.pack.match?(controllers_commented_pattern)
37
+ proceed = if StimulusReflex::Installer.options.key? "uncomment"
38
+ StimulusReflex::Installer.options["uncomment"]
39
39
  else
40
40
  !no?("✨ Do you want to import your Stimulus controllers in application.js? (Y/n)")
41
41
  end
42
42
 
43
43
  if proceed
44
44
  # uncomment_lines only works with Ruby comments 🙄
45
- lines = pack_path.readlines
45
+ lines = StimulusReflex::Installer.pack_path.readlines
46
46
  matches = lines.select { |line| line =~ controllers_commented_pattern }
47
47
  lines[lines.index(matches.last).to_i] = "import \"controllers\"\n"
48
- pack_path.write lines.join
49
- say "✅ Stimulus controllers imported in #{friendly_pack_path}"
48
+ StimulusReflex::Installer.pack_path.write lines.join
49
+ say "✅ Stimulus controllers imported in #{StimulusReflex::Installer.friendly_pack_path}"
50
50
  else
51
51
  say "🤷 your Stimulus controllers are not being imported in your application.js. We trust that you have a reason for this."
52
52
  end
53
53
  else
54
- say "✅ Stimulus controllers imported in #{friendly_pack_path}"
54
+ say "✅ Stimulus controllers imported in #{StimulusReflex::Installer.friendly_pack_path}"
55
55
  end
56
56
  else
57
- lines = pack_path.readlines
57
+ lines = StimulusReflex::Installer.pack_path.readlines
58
58
  matches = lines.select { |line| line =~ /^import / }
59
59
  lines.insert lines.index(matches.last).to_i + 1, "import \"controllers\"\n"
60
- pack_path.write lines.join
61
- say "✅ Stimulus controllers imported in #{friendly_pack_path}"
60
+ StimulusReflex::Installer.pack_path.write lines.join
61
+ say "✅ Stimulus controllers imported in #{StimulusReflex::Installer.friendly_pack_path}"
62
62
  end
63
63
 
64
- complete_step :shakapacker
64
+ StimulusReflex::Installer.complete_step :shakapacker
@@ -5,11 +5,11 @@ require "stimulus_reflex/installer"
5
5
  spring_pattern = /^[^#]*gem ["']spring["']/
6
6
 
7
7
  proceed = false
8
- lines = gemfile_path.readlines
8
+ lines = StimulusReflex::Installer.gemfile_path.readlines
9
9
 
10
10
  if lines.index { |line| line =~ spring_pattern }
11
- proceed = if options.key? "spring"
12
- options["spring"]
11
+ proceed = if StimulusReflex::Installer.options.key? "spring"
12
+ StimulusReflex::Installer.options["spring"]
13
13
  else
14
14
  !no?("✨ Would you like to disable the spring gem? \nIt's been removed from Rails 7, and is the frequent culprit behind countless mystery bugs. (Y/n)")
15
15
  end
@@ -22,7 +22,7 @@ if proceed
22
22
  bin_rails_pattern = /^[^#]*load File.expand_path\("spring", __dir__\)/
23
23
 
24
24
  if (index = lines.index { |line| line =~ spring_pattern })
25
- remove_gem :spring
25
+ StimulusReflex::Installer.remove_gem :spring
26
26
 
27
27
  bin_spring = Rails.root.join("bin/spring")
28
28
  if bin_spring.exist?
@@ -33,7 +33,7 @@ if proceed
33
33
  bin_rails = Rails.root.join("bin/rails")
34
34
  bin_rails_content = bin_rails.readlines
35
35
  if (index = bin_rails_content.index { |line| line =~ bin_rails_pattern })
36
- backup(bin_rails) do
36
+ StimulusReflex::Installer.backup(bin_rails) do
37
37
  bin_rails_content[index] = "# #{bin_rails_content[index]}"
38
38
  bin_rails.write bin_rails_content.join
39
39
  end
@@ -45,10 +45,10 @@ if proceed
45
45
  end
46
46
 
47
47
  if lines.index { |line| line =~ spring_watcher_pattern }
48
- remove_gem "spring-watcher-listen"
48
+ StimulusReflex::Installer.remove_gem "spring-watcher-listen"
49
49
  end
50
50
  else
51
51
  say "⏩ Skipping."
52
52
  end
53
53
 
54
- complete_step :spring
54
+ StimulusReflex::Installer.complete_step :spring
@@ -2,18 +2,18 @@
2
2
 
3
3
  require "stimulus_reflex/installer"
4
4
 
5
- if application_record_path.exist?
6
- lines = application_record_path.readlines
5
+ if StimulusReflex::Installer.application_record_path.exist?
6
+ lines = StimulusReflex::Installer.application_record_path.readlines
7
7
 
8
8
  if !lines.index { |line| line =~ /^\s*include CableReady::Updatable/ }
9
- proceed = if options.key? "updatable"
10
- options["updatable"]
9
+ proceed = if StimulusReflex::Installer.options.key? "updatable"
10
+ StimulusReflex::Installer.options["updatable"]
11
11
  else
12
12
  !no?("✨ Include CableReady::Updatable in Active Record model classes? (Y/n)")
13
13
  end
14
14
 
15
15
  unless proceed
16
- complete_step :updatable
16
+ StimulusReflex::Installer.complete_step :updatable
17
17
 
18
18
  puts "⏩ Skipping."
19
19
  return
@@ -21,7 +21,7 @@ if application_record_path.exist?
21
21
 
22
22
  index = lines.index { |line| line.include?("class ApplicationRecord < ActiveRecord::Base") }
23
23
  lines.insert index + 1, " include CableReady::Updatable\n"
24
- application_record_path.write lines.join
24
+ StimulusReflex::Installer.application_record_path.write lines.join
25
25
 
26
26
  say "✅ included CableReady::Updatable in ApplicationRecord"
27
27
  else
@@ -31,4 +31,4 @@ else
31
31
  say "⏩ ApplicationRecord doesn't exist. Skipping."
32
32
  end
33
33
 
34
- complete_step :updatable
34
+ StimulusReflex::Installer.complete_step :updatable
data/lib/install/vite.rb CHANGED
@@ -2,27 +2,27 @@
2
2
 
3
3
  require "stimulus_reflex/installer"
4
4
 
5
- return if pack_path_missing?
5
+ return if StimulusReflex::Installer.pack_path_missing?
6
6
 
7
7
  # verify that all critical dependencies are up to date; if not, queue for later
8
- lines = package_json_path.readlines
8
+ lines = StimulusReflex::Installer.package_json_path.readlines
9
9
 
10
10
  if !lines.index { |line| line =~ /^\s*["']stimulus-vite-helpers["']: ["']\^3["']/ }
11
- add_package "stimulus-vite-helpers@^3"
11
+ StimulusReflex::Installer.add_package "stimulus-vite-helpers@^3"
12
12
  else
13
13
  say "⏩ @stimulus-vite-helpers npm package is already present. Skipping."
14
14
  end
15
15
 
16
16
  step_path = "/app/javascript/controllers/"
17
- application_controller_src = fetch(step_path, "application_controller.js.tt")
18
- application_controller_path = controllers_path / "application_controller.js"
19
- application_js_src = fetch(step_path, "application.js.tt")
20
- application_js_path = controllers_path / "application.js"
21
- index_src = fetch(step_path, "index.js.vite.tt")
22
- index_path = controllers_path / "index.js"
17
+ application_controller_src = StimulusReflex::Installer.fetch(step_path, "application_controller.js.tt")
18
+ application_controller_path = StimulusReflex::Installer.controllers_path / "application_controller.js"
19
+ application_js_src = StimulusReflex::Installer.fetch(step_path, "application.js.tt")
20
+ application_js_path = StimulusReflex::Installer.controllers_path / "application.js"
21
+ index_src = StimulusReflex::Installer.fetch(step_path, "index.js.vite.tt")
22
+ index_path = StimulusReflex::Installer.controllers_path / "index.js"
23
23
 
24
24
  # create entrypoint/controllers, as well as the index, application and application_controller
25
- empty_directory controllers_path unless controllers_path.exist?
25
+ empty_directory StimulusReflex::Installer.controllers_path unless StimulusReflex::Installer.controllers_path.exist?
26
26
 
27
27
  copy_file(application_controller_src, application_controller_path) unless application_controller_path.exist?
28
28
  copy_file(application_js_src, application_js_path) unless application_js_path.exist?
@@ -32,33 +32,33 @@ controllers_pattern = /import ['"](\.\.\/)?controllers['"]/
32
32
  controllers_commented_pattern = /\s*\/\/\s*#{controllers_pattern}/
33
33
  prefix = "..\/" # standard:disable Style/RedundantStringEscape
34
34
 
35
- if pack.match?(controllers_pattern)
36
- if pack.match?(controllers_commented_pattern)
37
- proceed = if options.key? "uncomment"
38
- options["uncomment"]
35
+ if StimulusReflex::Installer.pack.match?(controllers_pattern)
36
+ if StimulusReflex::Installer.pack.match?(controllers_commented_pattern)
37
+ proceed = if StimulusReflex::Installer.options.key? "uncomment"
38
+ StimulusReflex::Installer.options["uncomment"]
39
39
  else
40
40
  !no?("✨ Do you want to import your Stimulus controllers in application.js? (Y/n)")
41
41
  end
42
42
 
43
43
  if proceed
44
44
  # uncomment_lines only works with Ruby comments 🙄
45
- lines = pack_path.readlines
45
+ lines = StimulusReflex::Installer.pack_path.readlines
46
46
  matches = lines.select { |line| line =~ controllers_commented_pattern }
47
47
  lines[lines.index(matches.last).to_i] = "import \"#{prefix}controllers\"\n"
48
- pack_path.write lines.join
49
- say "✅ Uncommented Stimulus controllers import in #{friendly_pack_path}"
48
+ StimulusReflex::Installer.pack_path.write lines.join
49
+ say "✅ Uncommented Stimulus controllers import in #{StimulusReflex::Installer.friendly_pack_path}"
50
50
  else
51
51
  say "🤷 your Stimulus controllers are not being imported in your application.js. We trust that you have a reason for this."
52
52
  end
53
53
  else
54
- say "⏩ Stimulus controllers are already being imported in #{friendly_pack_path}. Skipping."
54
+ say "⏩ Stimulus controllers are already being imported in #{StimulusReflex::Installer.friendly_pack_path}. Skipping."
55
55
  end
56
56
  else
57
- lines = pack_path.readlines
57
+ lines = StimulusReflex::Installer.pack_path.readlines
58
58
  matches = lines.select { |line| line =~ /^import / }
59
59
  lines.insert lines.index(matches.last).to_i + 1, "import \"#{prefix}controllers\"\n"
60
- pack_path.write lines.join
61
- say "✅ Stimulus controllers imported in #{friendly_pack_path}"
60
+ StimulusReflex::Installer.pack_path.write lines.join
61
+ say "✅ Stimulus controllers imported in #{StimulusReflex::Installer.friendly_pack_path}"
62
62
  end
63
63
 
64
- complete_step :vite
64
+ StimulusReflex::Installer.complete_step :vite
@@ -2,50 +2,50 @@
2
2
 
3
3
  require "stimulus_reflex/installer"
4
4
 
5
- return if pack_path_missing?
5
+ return if StimulusReflex::Installer.pack_path_missing?
6
6
 
7
7
  # verify that all critical dependencies are up to date; if not, queue for later
8
- lines = package_json_path.readlines
8
+ lines = StimulusReflex::Installer.package_json_path.readlines
9
9
  if !lines.index { |line| line =~ /^\s*["']webpack["']: ["']\^4.46.0["']/ }
10
- add_package "webpack@^4.46.0"
10
+ StimulusReflex::Installer.add_package "webpack@^4.46.0"
11
11
  else
12
12
  say "⏩ webpack npm package is already present. Skipping."
13
13
  end
14
14
 
15
15
  if !lines.index { |line| line =~ /^\s*["']webpack-cli["']: ["']\^3.3.12["']/ }
16
- add_package "webpack-cli@^3.3.12"
16
+ StimulusReflex::Installer.add_package "webpack-cli@^3.3.12"
17
17
  else
18
18
  say "⏩ webpack-cli npm package is already present. Skipping."
19
19
  end
20
20
 
21
21
  if !lines.index { |line| line =~ /^\s*["']@rails\/webpacker["']: ["']\^5.4.3["']/ }
22
- add_package "@rails/webpacker@^5.4.3"
22
+ StimulusReflex::Installer.add_package "@rails/webpacker@^5.4.3"
23
23
  else
24
24
  say "⏩ @rails/webpacker npm package is already present. Skipping."
25
25
  end
26
26
 
27
27
  if !lines.index { |line| line =~ /^\s*["']@hotwired\/stimulus-webpack-helpers["']: ["']\^1.0.1["']/ }
28
- add_package "@hotwired/stimulus-webpack-helpers@^1.0.1"
28
+ StimulusReflex::Installer.add_package "@hotwired/stimulus-webpack-helpers@^1.0.1"
29
29
  else
30
30
  say "⏩ @hotwired/stimulus-webpack-helpers npm package is already present. Skipping."
31
31
  end
32
32
 
33
33
  if !lines.index { |line| line =~ /^\s*["']webpack-dev-server["']: ["']\^3.11.3["']/ }
34
- add_dev_package "webpack-dev-server@^3.11.3"
34
+ StimulusReflex::Installer.add_dev_package "webpack-dev-server@^3.11.3"
35
35
  else
36
36
  say "⏩ @webpack-dev-server is already present. Skipping."
37
37
  end
38
38
 
39
39
  step_path = "/app/javascript/controllers/"
40
- application_controller_src = fetch(step_path, "application_controller.js.tt")
41
- application_controller_path = controllers_path / "application_controller.js"
42
- application_js_src = fetch(step_path, "application.js.tt")
43
- application_js_path = controllers_path / "application.js"
44
- index_src = fetch(step_path, "index.js.webpacker.tt")
45
- index_path = controllers_path / "index.js"
40
+ application_controller_src = StimulusReflex::Installer.fetch(step_path, "application_controller.js.tt")
41
+ application_controller_path = StimulusReflex::Installer.controllers_path / "application_controller.js"
42
+ application_js_src = StimulusReflex::Installer.fetch(step_path, "application.js.tt")
43
+ application_js_path = StimulusReflex::Installer.controllers_path / "application.js"
44
+ index_src = StimulusReflex::Installer.fetch(step_path, "index.js.webpacker.tt")
45
+ index_path = StimulusReflex::Installer.controllers_path / "index.js"
46
46
 
47
47
  # create entrypoint/controllers, as well as the index, application and application_controller
48
- empty_directory controllers_path unless controllers_path.exist?
48
+ empty_directory StimulusReflex::Installer.controllers_path unless StimulusReflex::Installer.controllers_path.exist?
49
49
 
50
50
  copy_file(application_controller_src, application_controller_path) unless application_controller_path.exist?
51
51
  # webpacker 5.4 did not colloquially feature a controllers/application.js file
@@ -55,36 +55,36 @@ copy_file(index_src, index_path) unless index_path.exist?
55
55
  controllers_pattern = /import ['"]controllers['"]/
56
56
  controllers_commented_pattern = /\s*\/\/\s*#{controllers_pattern}/
57
57
 
58
- if pack.match?(controllers_pattern)
59
- if pack.match?(controllers_commented_pattern)
60
- proceed = if options.key? "uncomment"
61
- options["uncomment"]
58
+ if StimulusReflex::Installer.pack.match?(controllers_pattern)
59
+ if StimulusReflex::Installer.pack.match?(controllers_commented_pattern)
60
+ proceed = if StimulusReflex::Installer.options.key? "uncomment"
61
+ StimulusReflex::Installer.options["uncomment"]
62
62
  else
63
63
  !no?("✨ Do you want to import your Stimulus controllers in application.js? (Y/n)")
64
64
  end
65
65
 
66
66
  if proceed
67
67
  # uncomment_lines only works with Ruby comments 🙄
68
- lines = pack_path.readlines
68
+ lines = StimulusReflex::Installer.pack_path.readlines
69
69
  matches = lines.select { |line| line =~ controllers_commented_pattern }
70
70
  lines[lines.index(matches.last).to_i] = "import \"controllers\"\n"
71
- pack_path.write lines.join
72
- say "✅ Uncommented Stimulus controllers import in #{friendly_pack_path}"
71
+ StimulusReflex::Installer.pack_path.write lines.join
72
+ say "✅ Uncommented Stimulus controllers import in #{StimulusReflex::Installer.friendly_pack_path}"
73
73
  else
74
74
  say "🤷 your Stimulus controllers are not being imported in your application.js. We trust that you have a reason for this."
75
75
  end
76
76
  else
77
- say "⏩ Stimulus controllers are already being imported in #{friendly_pack_path}. Skipping."
77
+ say "⏩ Stimulus controllers are already being imported in #{StimulusReflex::Installer.friendly_pack_path}. Skipping."
78
78
  end
79
79
  else
80
- lines = pack_path.readlines
80
+ lines = StimulusReflex::Installer.pack_path.readlines
81
81
  matches = lines.select { |line| line =~ /^import / }
82
82
  lines.insert lines.index(matches.last).to_i + 1, "import \"controllers\"\n"
83
- pack_path.write lines.join
84
- say "✅ Stimulus controllers imported in #{friendly_pack_path}"
83
+ StimulusReflex::Installer.pack_path.write lines.join
84
+ say "✅ Stimulus controllers imported in #{StimulusReflex::Installer.friendly_pack_path}"
85
85
  end
86
86
 
87
87
  # ensure webpacker is installed in the Gemfile
88
- add_gem "webpacker@5.4.3"
88
+ StimulusReflex::Installer.add_gem "webpacker@5.4.3"
89
89
 
90
- complete_step :webpacker
90
+ StimulusReflex::Installer.complete_step :webpacker
data/lib/install/yarn.rb CHANGED
@@ -2,18 +2,18 @@
2
2
 
3
3
  require "stimulus_reflex/installer"
4
4
 
5
- if !package_json_path.exist?
5
+ if !StimulusReflex::Installer.package_json_path.exist?
6
6
  say "⏩ No package.json file found. Skipping."
7
7
 
8
8
  return
9
9
  end
10
10
 
11
11
  # run yarn install only when packages are waiting to be added or removed
12
- add = package_list.exist? ? package_list.readlines.map(&:chomp) : []
13
- dev = dev_package_list.exist? ? dev_package_list.readlines.map(&:chomp) : []
14
- drop = drop_package_list.exist? ? drop_package_list.readlines.map(&:chomp) : []
12
+ add = StimulusReflex::Installer.package_list.exist? ? StimulusReflex::Installer.package_list.readlines.map(&:chomp) : []
13
+ dev = StimulusReflex::Installer.dev_package_list.exist? ? StimulusReflex::Installer.dev_package_list.readlines.map(&:chomp) : []
14
+ drop = StimulusReflex::Installer.drop_package_list.exist? ? StimulusReflex::Installer.drop_package_list.readlines.map(&:chomp) : []
15
15
 
16
- json = JSON.parse(package_json_path.read)
16
+ json = JSON.parse(StimulusReflex::Installer.package_json_path.read)
17
17
 
18
18
  if add.present? || dev.present? || drop.present?
19
19
 
@@ -36,20 +36,20 @@ if add.present? || dev.present? || drop.present?
36
36
  json["devDependencies"].delete(package)
37
37
  end
38
38
 
39
- package_json_path.write JSON.pretty_generate(json)
39
+ StimulusReflex::Installer.package_json_path.write JSON.pretty_generate(json)
40
40
 
41
41
  system "yarn install --silent"
42
42
  else
43
43
  say "⏩ No yarn depdencies to add or remove. Skipping."
44
44
  end
45
45
 
46
- if bundler == "esbuild" && json["scripts"]["build"] != "node esbuild.config.mjs"
46
+ if StimulusReflex::Installer.bundler == "esbuild" && json["scripts"]["build"] != "node esbuild.config.mjs"
47
47
  json["scripts"]["build:default"] = json["scripts"]["build"]
48
48
  json["scripts"]["build"] = "node esbuild.config.mjs"
49
- package_json_path.write JSON.pretty_generate(json)
49
+ StimulusReflex::Installer.package_json_path.write JSON.pretty_generate(json)
50
50
  say "✅ Your yarn build script has been updated to use esbuild.config.mjs"
51
51
  else
52
52
  say "⏩ Your yarn build script is already setup. Skipping."
53
53
  end
54
54
 
55
- complete_step :yarn
55
+ StimulusReflex::Installer.complete_step :yarn
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # forzen_string_literal: true
4
-
5
3
  module StimulusReflex
6
4
  module HTML
7
5
  class DocumentFragment < Document
8
6
  def parsing_class
9
- Nokogiri
7
+ Nokogiri::HTML5::Inference
8
+ end
9
+
10
+ def document_element
11
+ @document
10
12
  end
11
13
  end
12
14
  end