cable_ready 5.0.3 → 5.0.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 +4 -4
- data/Gemfile.lock +3 -1
- data/app/assets/javascripts/cable_ready.js +1 -1
- data/app/assets/javascripts/cable_ready.umd.js +1 -1
- data/cable_ready.gemspec +1 -0
- data/lib/cable_ready/installer.rb +196 -169
- data/lib/cable_ready/version.rb +1 -1
- data/lib/install/action_cable.rb +29 -29
- data/lib/install/broadcaster.rb +13 -13
- data/lib/install/bundle.rb +9 -9
- data/lib/install/compression.rb +7 -7
- data/lib/install/config.rb +17 -17
- data/lib/install/development.rb +6 -6
- data/lib/install/esbuild.rb +28 -28
- data/lib/install/importmap.rb +25 -25
- data/lib/install/initializers.rb +2 -2
- data/lib/install/mrujs.rb +22 -22
- data/lib/install/npm_packages.rb +4 -4
- data/lib/install/shakapacker.rb +21 -21
- data/lib/install/spring.rb +7 -7
- data/lib/install/updatable.rb +7 -7
- data/lib/install/vite.rb +21 -21
- data/lib/install/webpacker.rb +22 -22
- data/lib/install/yarn.rb +9 -9
- data/package.json +1 -1
- data/yarn.lock +156 -306
- metadata +17 -8
- data/app/assets/javascripts/cable_ready.min.js +0 -2
- data/app/assets/javascripts/cable_ready.min.js.map +0 -1
- data/app/assets/javascripts/cable_ready.umd.min.js +0 -2
- data/app/assets/javascripts/cable_ready.umd.min.js.map +0 -1
- data/cable_ready.gemspec~ +0 -40
data/lib/install/shakapacker.rb
CHANGED
@@ -2,30 +2,30 @@
|
|
2
2
|
|
3
3
|
require "cable_ready/installer"
|
4
4
|
|
5
|
-
return if pack_path_missing?
|
5
|
+
return if CableReady::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.readlines
|
8
|
+
lines = CableReady::Installer.package_json.readlines
|
9
9
|
if !lines.index { |line| line =~ /^\s*["']@hotwired\/stimulus["']:/ }
|
10
|
-
add_package "@hotwired/stimulus@^3.2"
|
10
|
+
CableReady::Installer.add_package "@hotwired/stimulus@^3.2"
|
11
11
|
else
|
12
12
|
say "⏩ @hotwired/stimulus npm package is already present. Skipping."
|
13
13
|
end
|
14
14
|
|
15
15
|
if !lines.index { |line| line =~ /^\s*["']@hotwired\/stimulus-webpack-helpers["']: ["']\^1.0.1["']/ }
|
16
|
-
add_package "@hotwired/stimulus-webpack-helpers@^1.0.1"
|
16
|
+
CableReady::Installer.add_package "@hotwired/stimulus-webpack-helpers@^1.0.1"
|
17
17
|
else
|
18
18
|
say "⏩ @hotwired/stimulus-webpack-helpers npm package is already present. Skipping."
|
19
19
|
end
|
20
20
|
|
21
21
|
step_path = "/app/javascript/controllers/"
|
22
|
-
application_js_src = fetch(step_path, "application.js.tt")
|
23
|
-
application_js_path = controllers_path / "application.js"
|
24
|
-
index_src = fetch(step_path, "index.js.shakapacker.tt")
|
25
|
-
index_path = controllers_path / "index.js"
|
22
|
+
application_js_src = CableReady::Installer.fetch(step_path, "application.js.tt")
|
23
|
+
application_js_path = CableReady::Installer.controllers_path / "application.js"
|
24
|
+
index_src = CableReady::Installer.fetch(step_path, "index.js.shakapacker.tt")
|
25
|
+
index_path = CableReady::Installer.controllers_path / "index.js"
|
26
26
|
|
27
27
|
# create entrypoint/controllers, as well as the index, application and application_controller
|
28
|
-
empty_directory controllers_path unless controllers_path.exist?
|
28
|
+
empty_directory CableReady::Installer.controllers_path unless CableReady::Installer.controllers_path.exist?
|
29
29
|
|
30
30
|
copy_file(application_js_src, application_js_path) unless application_js_path.exist?
|
31
31
|
copy_file(index_src, index_path) unless index_path.exist?
|
@@ -33,33 +33,33 @@ copy_file(index_src, index_path) unless index_path.exist?
|
|
33
33
|
controllers_pattern = /import ['"]controllers['"]/
|
34
34
|
controllers_commented_pattern = /\s*\/\/\s*#{controllers_pattern}/
|
35
35
|
|
36
|
-
if pack.match?(controllers_pattern)
|
37
|
-
if pack.match?(controllers_commented_pattern)
|
38
|
-
proceed = if options.key? "uncomment"
|
39
|
-
options["uncomment"]
|
36
|
+
if CableReady::Installer.pack.match?(controllers_pattern)
|
37
|
+
if CableReady::Installer.pack.match?(controllers_commented_pattern)
|
38
|
+
proceed = if CableReady::Installer.options.key? "uncomment"
|
39
|
+
CableReady::Installer.options["uncomment"]
|
40
40
|
else
|
41
41
|
!no?("✨ Do you want to import your Stimulus controllers in application.js? (Y/n)")
|
42
42
|
end
|
43
43
|
|
44
44
|
if proceed
|
45
45
|
# uncomment_lines only works with Ruby comments 🙄
|
46
|
-
lines = pack_path.readlines
|
46
|
+
lines = CableReady::Installer.pack_path.readlines
|
47
47
|
matches = lines.select { |line| line =~ controllers_commented_pattern }
|
48
48
|
lines[lines.index(matches.last).to_i] = "import \"controllers\"\n"
|
49
|
-
pack_path.write lines.join
|
50
|
-
say "✅ Stimulus controllers imported in #{friendly_pack_path}"
|
49
|
+
CableReady::Installer.pack_path.write lines.join
|
50
|
+
say "✅ Stimulus controllers imported in #{CableReady::Installer.friendly_pack_path}"
|
51
51
|
else
|
52
52
|
say "🤷 your Stimulus controllers are not being imported in your application.js. We trust that you have a reason for this."
|
53
53
|
end
|
54
54
|
else
|
55
|
-
say "✅ Stimulus controllers imported in #{friendly_pack_path}"
|
55
|
+
say "✅ Stimulus controllers imported in #{CableReady::Installer.friendly_pack_path}"
|
56
56
|
end
|
57
57
|
else
|
58
|
-
lines = pack_path.readlines
|
58
|
+
lines = CableReady::Installer.pack_path.readlines
|
59
59
|
matches = lines.select { |line| line =~ /^import / }
|
60
60
|
lines.insert lines.index(matches.last).to_i + 1, "import \"controllers\"\n"
|
61
|
-
pack_path.write lines.join
|
62
|
-
say "✅ Stimulus controllers imported in #{friendly_pack_path}"
|
61
|
+
CableReady::Installer.pack_path.write lines.join
|
62
|
+
say "✅ Stimulus controllers imported in #{CableReady::Installer.friendly_pack_path}"
|
63
63
|
end
|
64
64
|
|
65
|
-
complete_step :shakapacker
|
65
|
+
CableReady::Installer.complete_step :shakapacker
|
data/lib/install/spring.rb
CHANGED
@@ -5,11 +5,11 @@ require "cable_ready/installer"
|
|
5
5
|
spring_pattern = /^[^#]*gem ["']spring["']/
|
6
6
|
|
7
7
|
proceed = false
|
8
|
-
lines = gemfile_path.readlines
|
8
|
+
lines = CableReady::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 CableReady::Installer.options.key? "spring"
|
12
|
+
CableReady::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
|
+
CableReady::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
|
+
CableReady::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
|
+
CableReady::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
|
+
CableReady::Installer.complete_step :spring
|
data/lib/install/updatable.rb
CHANGED
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
require "cable_ready/installer"
|
4
4
|
|
5
|
-
if application_record_path.exist?
|
6
|
-
lines = application_record_path.readlines
|
5
|
+
if CableReady::Installer.application_record_path.exist?
|
6
|
+
lines = CableReady::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 CableReady::Installer.options.key? "updatable"
|
10
|
+
CableReady::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
|
+
CableReady::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
|
+
CableReady::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
|
+
CableReady::Installer.complete_step :updatable
|
data/lib/install/vite.rb
CHANGED
@@ -2,30 +2,30 @@
|
|
2
2
|
|
3
3
|
require "cable_ready/installer"
|
4
4
|
|
5
|
-
return if pack_path_missing?
|
5
|
+
return if CableReady::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.readlines
|
8
|
+
lines = CableReady::Installer.package_json.readlines
|
9
9
|
if !lines.index { |line| line =~ /^\s*["']@hotwired\/stimulus["']:/ }
|
10
|
-
add_package "@hotwired/stimulus@^3.2"
|
10
|
+
CableReady::Installer.add_package "@hotwired/stimulus@^3.2"
|
11
11
|
else
|
12
12
|
say "⏩ @hotwired/stimulus npm package is already present. Skipping."
|
13
13
|
end
|
14
14
|
|
15
15
|
if !lines.index { |line| line =~ /^\s*["']stimulus-vite-helpers["']: ["']\^3["']/ }
|
16
|
-
add_package "stimulus-vite-helpers@^3"
|
16
|
+
CableReady::Installer.add_package "stimulus-vite-helpers@^3"
|
17
17
|
else
|
18
18
|
say "⏩ @stimulus-vite-helpers npm package is already present. Skipping."
|
19
19
|
end
|
20
20
|
|
21
21
|
step_path = "/app/javascript/controllers/"
|
22
|
-
application_js_src = fetch(step_path, "application.js.tt")
|
23
|
-
application_js_path = controllers_path / "application.js"
|
24
|
-
index_src = fetch(step_path, "index.js.vite.tt")
|
25
|
-
index_path = controllers_path / "index.js"
|
22
|
+
application_js_src = CableReady::Installer.fetch(step_path, "application.js.tt")
|
23
|
+
application_js_path = CableReady::Installer.controllers_path / "application.js"
|
24
|
+
index_src = CableReady::Installer.fetch(step_path, "index.js.vite.tt")
|
25
|
+
index_path = CableReady::Installer.controllers_path / "index.js"
|
26
26
|
|
27
27
|
# create entrypoint/controllers, as well as the index, application and application_controller
|
28
|
-
empty_directory controllers_path unless controllers_path.exist?
|
28
|
+
empty_directory CableReady::Installer.controllers_path unless CableReady::Installer.controllers_path.exist?
|
29
29
|
|
30
30
|
copy_file(application_js_src, application_js_path) unless application_js_path.exist?
|
31
31
|
copy_file(index_src, index_path) unless index_path.exist?
|
@@ -34,33 +34,33 @@ controllers_pattern = /import ['"](\.\.\/)?controllers['"]/
|
|
34
34
|
controllers_commented_pattern = /\s*\/\/\s*#{controllers_pattern}/
|
35
35
|
prefix = "..\/" # standard:disable Style/RedundantStringEscape
|
36
36
|
|
37
|
-
if pack.match?(controllers_pattern)
|
38
|
-
if pack.match?(controllers_commented_pattern)
|
39
|
-
proceed = if options.key? "uncomment"
|
40
|
-
options["uncomment"]
|
37
|
+
if CableReady::Installer.pack.match?(controllers_pattern)
|
38
|
+
if CableReady::Installer.pack.match?(controllers_commented_pattern)
|
39
|
+
proceed = if CableReady::Installer.options.key? "uncomment"
|
40
|
+
CableReady::Installer.options["uncomment"]
|
41
41
|
else
|
42
42
|
!no?("✨ Do you want to import your Stimulus controllers in application.js? (Y/n)")
|
43
43
|
end
|
44
44
|
|
45
45
|
if proceed
|
46
46
|
# uncomment_lines only works with Ruby comments 🙄
|
47
|
-
lines = pack_path.readlines
|
47
|
+
lines = CableReady::Installer.pack_path.readlines
|
48
48
|
matches = lines.select { |line| line =~ controllers_commented_pattern }
|
49
49
|
lines[lines.index(matches.last).to_i] = "import \"#{prefix}controllers\"\n"
|
50
|
-
pack_path.write lines.join
|
51
|
-
say "✅ Stimulus controllers imported in #{friendly_pack_path}"
|
50
|
+
CableReady::Installer.pack_path.write lines.join
|
51
|
+
say "✅ Stimulus controllers imported in #{CableReady::Installer.friendly_pack_path}"
|
52
52
|
else
|
53
53
|
say "🤷 your Stimulus controllers are not being imported in your application.js. We trust that you have a reason for this."
|
54
54
|
end
|
55
55
|
else
|
56
|
-
say "✅ Stimulus controllers imported in #{friendly_pack_path}"
|
56
|
+
say "✅ Stimulus controllers imported in #{CableReady::Installer.friendly_pack_path}"
|
57
57
|
end
|
58
58
|
else
|
59
|
-
lines = pack_path.readlines
|
59
|
+
lines = CableReady::Installer.pack_path.readlines
|
60
60
|
matches = lines.select { |line| line =~ /^import / }
|
61
61
|
lines.insert lines.index(matches.last).to_i + 1, "import \"#{prefix}controllers\"\n"
|
62
|
-
pack_path.write lines.join
|
63
|
-
say "✅ Stimulus controllers imported in #{friendly_pack_path}"
|
62
|
+
CableReady::Installer.pack_path.write lines.join
|
63
|
+
say "✅ Stimulus controllers imported in #{CableReady::Installer.friendly_pack_path}"
|
64
64
|
end
|
65
65
|
|
66
|
-
complete_step :vite
|
66
|
+
CableReady::Installer.complete_step :vite
|
data/lib/install/webpacker.rb
CHANGED
@@ -2,54 +2,54 @@
|
|
2
2
|
|
3
3
|
require "cable_ready/installer"
|
4
4
|
|
5
|
-
return if pack_path_missing?
|
5
|
+
return if CableReady::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.readlines
|
8
|
+
lines = CableReady::Installer.package_json.readlines
|
9
9
|
if !lines.index { |line| line =~ /^\s*["']webpack["']: ["']\^4.46.0["']/ }
|
10
|
-
add_package "webpack@^4.46.0"
|
10
|
+
CableReady::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
|
+
CableReady::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
|
+
CableReady::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["']:/ }
|
28
|
-
add_package "@hotwired/stimulus@^3.2"
|
28
|
+
CableReady::Installer.add_package "@hotwired/stimulus@^3.2"
|
29
29
|
else
|
30
30
|
say "⏩ @hotwired/stimulus npm package is already present. Skipping."
|
31
31
|
end
|
32
32
|
|
33
33
|
if !lines.index { |line| line =~ /^\s*["']@hotwired\/stimulus-webpack-helpers["']: ["']\^1.0.1["']/ }
|
34
|
-
add_package "@hotwired/stimulus-webpack-helpers@^1.0.1"
|
34
|
+
CableReady::Installer.add_package "@hotwired/stimulus-webpack-helpers@^1.0.1"
|
35
35
|
else
|
36
36
|
say "⏩ @hotwired/stimulus-webpack-helpers npm package is already present. Skipping."
|
37
37
|
end
|
38
38
|
|
39
39
|
if !lines.index { |line| line =~ /^\s*["']webpack-dev-server["']: ["']\^3.11.3["']/ }
|
40
|
-
add_dev_package "webpack-dev-server@^3.11.3"
|
40
|
+
CableReady::Installer.add_dev_package "webpack-dev-server@^3.11.3"
|
41
41
|
else
|
42
42
|
say "⏩ @webpack-dev-server is already present. Skipping."
|
43
43
|
end
|
44
44
|
|
45
45
|
step_path = "/app/javascript/controllers/"
|
46
|
-
application_js_src = fetch(step_path, "application.js.tt")
|
47
|
-
application_js_path = controllers_path / "application.js"
|
48
|
-
index_src = fetch(step_path, "index.js.webpacker.tt")
|
49
|
-
index_path = controllers_path / "index.js"
|
46
|
+
application_js_src = CableReady::Installer.fetch(step_path, "application.js.tt")
|
47
|
+
application_js_path = CableReady::Installer.controllers_path / "application.js"
|
48
|
+
index_src = CableReady::Installer.fetch(step_path, "index.js.webpacker.tt")
|
49
|
+
index_path = CableReady::Installer.controllers_path / "index.js"
|
50
50
|
|
51
51
|
# create entrypoint/controllers, as well as the index, application and application_controller
|
52
|
-
empty_directory controllers_path unless controllers_path.exist?
|
52
|
+
empty_directory CableReady::Installer.controllers_path unless CableReady::Installer.controllers_path.exist?
|
53
53
|
|
54
54
|
# webpacker 5.4 did not colloquially feature a controllers/application.js file
|
55
55
|
copy_file(application_js_src, application_js_path) unless application_js_path.exist?
|
@@ -68,26 +68,26 @@ if pack.match?(controllers_pattern)
|
|
68
68
|
|
69
69
|
if proceed
|
70
70
|
# uncomment_lines only works with Ruby comments 🙄
|
71
|
-
lines = pack_path.readlines
|
71
|
+
lines = CableReady::Installer.pack_path.readlines
|
72
72
|
matches = lines.select { |line| line =~ controllers_commented_pattern }
|
73
73
|
lines[lines.index(matches.last).to_i] = "import \"controllers\"\n"
|
74
|
-
pack_path.write lines.join
|
75
|
-
say "✅ Stimulus controllers imported in #{friendly_pack_path}"
|
74
|
+
CableReady::Installer.pack_path.write lines.join
|
75
|
+
say "✅ Stimulus controllers imported in #{CableReady::Installer.friendly_pack_path}"
|
76
76
|
else
|
77
77
|
say "🤷 your Stimulus controllers are not being imported in your application.js. We trust that you have a reason for this."
|
78
78
|
end
|
79
79
|
else
|
80
|
-
say "✅ Stimulus controllers imported in #{friendly_pack_path}"
|
80
|
+
say "✅ Stimulus controllers imported in #{CableReady::Installer.friendly_pack_path}"
|
81
81
|
end
|
82
82
|
else
|
83
|
-
lines = pack_path.readlines
|
83
|
+
lines = CableReady::Installer.pack_path.readlines
|
84
84
|
matches = lines.select { |line| line =~ /^import / }
|
85
85
|
lines.insert lines.index(matches.last).to_i + 1, "import \"controllers\"\n"
|
86
|
-
pack_path.write lines.join
|
87
|
-
say "✅ Stimulus controllers imported in #{friendly_pack_path}"
|
86
|
+
CableReady::Installer.pack_path.write lines.join
|
87
|
+
say "✅ Stimulus controllers imported in #{CableReady::Installer.friendly_pack_path}"
|
88
88
|
end
|
89
89
|
|
90
90
|
# ensure webpacker is installed in the Gemfile
|
91
|
-
add_gem "webpacker@5.4.3"
|
91
|
+
CableReady::Installer.add_gem "webpacker@5.4.3"
|
92
92
|
|
93
|
-
complete_step :webpacker
|
93
|
+
CableReady::Installer.complete_step :webpacker
|
data/lib/install/yarn.rb
CHANGED
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
require "cable_ready/installer"
|
4
4
|
|
5
|
-
if !package_json.exist?
|
5
|
+
if !CableReady::Installer.package_json.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 = CableReady::Installer.package_list.exist? ? CableReady::Installer.package_list.readlines.map(&:chomp) : []
|
13
|
+
dev = CableReady::Installer.dev_package_list.exist? ? CableReady::Installer.dev_package_list.readlines.map(&:chomp) : []
|
14
|
+
drop = CableReady::Installer.drop_package_list.exist? ? CableReady::Installer.drop_package_list.readlines.map(&:chomp) : []
|
15
15
|
|
16
|
-
json = JSON.parse(package_json.read)
|
16
|
+
json = JSON.parse(CableReady::Installer.package_json.read)
|
17
17
|
|
18
18
|
if add.present? || dev.present? || drop.present?
|
19
19
|
|
@@ -36,7 +36,7 @@ if add.present? || dev.present? || drop.present?
|
|
36
36
|
json["devDependencies"].delete(package)
|
37
37
|
end
|
38
38
|
|
39
|
-
package_json.write JSON.pretty_generate(json)
|
39
|
+
CableReady::Installer.package_json.write JSON.pretty_generate(json)
|
40
40
|
|
41
41
|
system "yarn install --silent"
|
42
42
|
else
|
@@ -44,13 +44,13 @@ else
|
|
44
44
|
|
45
45
|
end
|
46
46
|
|
47
|
-
if bundler == "esbuild" && json["scripts"]["build"] != "node esbuild.config.mjs"
|
47
|
+
if CableReady::Installer.bundler == "esbuild" && json["scripts"]["build"] != "node esbuild.config.mjs"
|
48
48
|
json["scripts"]["build:default"] = json["scripts"]["build"]
|
49
49
|
json["scripts"]["build"] = "node esbuild.config.mjs"
|
50
|
-
package_json.write JSON.pretty_generate(json)
|
50
|
+
CableReady::Installer.package_json.write JSON.pretty_generate(json)
|
51
51
|
say "✅ Your build script has been updated to use esbuild.config.mjs"
|
52
52
|
else
|
53
53
|
say "⏩ Your build script is already setup. Skipping."
|
54
54
|
end
|
55
55
|
|
56
|
-
complete_step :yarn
|
56
|
+
CableReady::Installer.complete_step :yarn
|
data/package.json
CHANGED