react_on_rails 17.0.0.rc.1 → 17.0.0.rc.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 +4 -4
- data/.rubocop.yml +1 -0
- data/Gemfile.lock +1 -33
- data/Rakefile +1 -1
- data/lib/generators/react_on_rails/base_generator.rb +19 -9
- data/lib/generators/react_on_rails/demo_page_config.rb +6 -6
- data/lib/generators/react_on_rails/generator_helper.rb +39 -1
- data/lib/generators/react_on_rails/generator_messages/ci_section.rb +2 -2
- data/lib/generators/react_on_rails/generator_messages/package_manager_detection.rb +9 -9
- data/lib/generators/react_on_rails/generator_messages/shakapacker_status_section.rb +1 -1
- data/lib/generators/react_on_rails/generator_messages.rb +7 -7
- data/lib/generators/react_on_rails/install_generator.rb +8 -8
- data/lib/generators/react_on_rails/js_dependency_manager.rb +161 -64
- data/lib/generators/react_on_rails/pro_generator.rb +13 -13
- data/lib/generators/react_on_rails/react_with_redux_generator.rb +1 -1
- data/lib/generators/react_on_rails/rsc_setup/client_references.rb +514 -89
- data/lib/generators/react_on_rails/rsc_setup.rb +47 -28
- data/lib/generators/react_on_rails/shakapacker_precompile_hook_helper.rb +338 -22
- data/lib/generators/react_on_rails/templates/base/base/bin/shakapacker-precompile-hook +88 -0
- data/lib/generators/react_on_rails/templates/base/base/config/webpack/clientWebpackConfig.js.tt +2 -2
- data/lib/generators/react_on_rails/templates/base/base/config/webpack/serverWebpackConfig.js.tt +5 -5
- data/lib/generators/react_on_rails/templates/dev_tests/spec/rails_helper.rb +1 -1
- data/lib/generators/react_on_rails/templates/rsc/base/config/webpack/rscWebpackConfig.js.tt +133 -13
- data/lib/react_on_rails/controller.rb +2 -2
- data/lib/react_on_rails/dev/pack_generator.rb +5 -5
- data/lib/react_on_rails/dev/port_selector.rb +4 -4
- data/lib/react_on_rails/dev/process_manager.rb +3 -3
- data/lib/react_on_rails/dev/server_manager.rb +48 -148
- data/lib/react_on_rails/dev/service_checker.rb +1 -1
- data/lib/react_on_rails/doctor.rb +13 -104
- data/lib/react_on_rails/error.rb +3 -0
- data/lib/react_on_rails/git_utils.rb +3 -3
- data/lib/react_on_rails/helper.rb +33 -32
- data/lib/react_on_rails/locales/base.rb +2 -2
- data/lib/react_on_rails/packer_utils.rb +3 -3
- data/lib/react_on_rails/packs_generator.rb +309 -56
- data/lib/react_on_rails/prerender_error.rb +5 -5
- data/lib/react_on_rails/pro_helper.rb +2 -2
- data/lib/react_on_rails/pro_migration.rb +2 -2
- data/lib/react_on_rails/react_component/render_options.rb +1 -1
- data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +200 -14
- data/lib/react_on_rails/shakapacker_config_helpers.rb +139 -0
- data/lib/react_on_rails/system_checker.rb +4 -53
- data/lib/react_on_rails/test_helper/dev_assets_detector.rb +4 -4
- data/lib/react_on_rails/test_helper.rb +5 -5
- data/lib/react_on_rails/version.rb +1 -1
- data/lib/react_on_rails/version_synchronizer.rb +22 -22
- data/lib/tasks/doctor.rake +1 -1
- data/lib/tasks/locale.rake +1 -1
- data/lib/tasks/sync_versions.rake +1 -1
- data/rakelib/lint.rake +15 -2
- data/rakelib/run_rspec.rake +1 -1
- data/rakelib/task_helpers.rb +1 -0
- data/rakelib/update_changelog.rake +2 -2
- metadata +4 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5610a42464b29a2f8066e2a91d342838cdd1f3734c3965864e0a5bd0d18e4c8a
|
|
4
|
+
data.tar.gz: 551fc429af6eea0798b929d0aece8b417b4646dfed702c1dcd39ae26d52084ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b1df35fc94bc088e6a9afe96ca54ec651951149ae82415e55d1db023ef582089fb58f9536db698d0971633678b3d2d70188c0ca355217fd9f6a854ead1f177c
|
|
7
|
+
data.tar.gz: c1371c43729036f9f9dbb78d68b85be81919a98a16fb8d3d4185b94c0f48c92506404bedb6e1a7a804b52596ae784b4f60487cc4bad8333f0933e38aa005551a
|
data/.rubocop.yml
CHANGED
|
@@ -11,6 +11,7 @@ AllCops:
|
|
|
11
11
|
|
|
12
12
|
Exclude:
|
|
13
13
|
- 'spec/dummy/bin/*'
|
|
14
|
+
- 'spec/react_on_rails/dummy-for-generators/**/*' # Generated fixture contains intentionally invalid Ruby
|
|
14
15
|
- 'spike/**/*' # Exploratory spike code outside lib/ — not part of the production surface
|
|
15
16
|
|
|
16
17
|
Naming/FileName:
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
react_on_rails (17.0.0.rc.
|
|
4
|
+
react_on_rails (17.0.0.rc.2)
|
|
5
5
|
addressable
|
|
6
6
|
connection_pool
|
|
7
7
|
execjs (~> 2.5)
|
|
@@ -207,7 +207,6 @@ GEM
|
|
|
207
207
|
racc (~> 1.4)
|
|
208
208
|
ostruct (0.6.1)
|
|
209
209
|
package_json (0.2.0)
|
|
210
|
-
parallel (1.24.0)
|
|
211
210
|
parser (3.3.1.0)
|
|
212
211
|
ast (~> 2.4.1)
|
|
213
212
|
racc
|
|
@@ -313,34 +312,6 @@ GEM
|
|
|
313
312
|
rspec-support (3.13.1)
|
|
314
313
|
rspec_junit_formatter (0.6.0)
|
|
315
314
|
rspec-core (>= 2, < 4, != 2.12.0)
|
|
316
|
-
rubocop (1.61.0)
|
|
317
|
-
json (~> 2.3)
|
|
318
|
-
language_server-protocol (>= 3.17.0)
|
|
319
|
-
parallel (~> 1.10)
|
|
320
|
-
parser (>= 3.3.0.2)
|
|
321
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
322
|
-
regexp_parser (>= 1.8, < 3.0)
|
|
323
|
-
rexml (>= 3.2.5, < 4.0)
|
|
324
|
-
rubocop-ast (>= 1.30.0, < 2.0)
|
|
325
|
-
ruby-progressbar (~> 1.7)
|
|
326
|
-
unicode-display_width (>= 2.4.0, < 3.0)
|
|
327
|
-
rubocop-ast (1.31.3)
|
|
328
|
-
parser (>= 3.3.1.0)
|
|
329
|
-
rubocop-capybara (2.20.0)
|
|
330
|
-
rubocop (~> 1.41)
|
|
331
|
-
rubocop-factory_bot (2.25.1)
|
|
332
|
-
rubocop (~> 1.41)
|
|
333
|
-
rubocop-performance (1.20.2)
|
|
334
|
-
rubocop (>= 1.48.1, < 2.0)
|
|
335
|
-
rubocop-ast (>= 1.30.0, < 2.0)
|
|
336
|
-
rubocop-rspec (2.29.2)
|
|
337
|
-
rubocop (~> 1.40)
|
|
338
|
-
rubocop-capybara (~> 2.17)
|
|
339
|
-
rubocop-factory_bot (~> 2.22)
|
|
340
|
-
rubocop-rspec_rails (~> 2.28)
|
|
341
|
-
rubocop-rspec_rails (2.28.3)
|
|
342
|
-
rubocop (~> 1.40)
|
|
343
|
-
ruby-progressbar (1.13.0)
|
|
344
315
|
rubyzip (2.3.2)
|
|
345
316
|
sass-rails (6.0.0)
|
|
346
317
|
sassc-rails (~> 2.1, >= 2.1.1)
|
|
@@ -469,9 +440,6 @@ DEPENDENCIES
|
|
|
469
440
|
rspec-rails
|
|
470
441
|
rspec-retry
|
|
471
442
|
rspec_junit_formatter
|
|
472
|
-
rubocop (= 1.61.0)
|
|
473
|
-
rubocop-performance (~> 1.20.0)
|
|
474
|
-
rubocop-rspec (~> 2.26)
|
|
475
443
|
sass-rails (~> 6.0)
|
|
476
444
|
sdoc
|
|
477
445
|
selenium-webdriver (= 4.9.0)
|
data/Rakefile
CHANGED
|
@@ -13,7 +13,7 @@ desc "All actions but no examples, good for local developer run."
|
|
|
13
13
|
task all_but_examples: ["run_rspec:all_but_examples", "lint"]
|
|
14
14
|
|
|
15
15
|
desc "Prepare for ci, including node_package, dummy app, and generator examples"
|
|
16
|
-
task
|
|
16
|
+
task(prepare_for_ci:)
|
|
17
17
|
|
|
18
18
|
desc "Runs prepare_for_ci and tasks"
|
|
19
19
|
task ci: [:prepare_for_ci, *tasks]
|
|
@@ -109,6 +109,14 @@ module ReactOnRails
|
|
|
109
109
|
def shakapacker_version_9_or_higher?
|
|
110
110
|
generator.__send__(:shakapacker_version_9_or_higher?)
|
|
111
111
|
end
|
|
112
|
+
|
|
113
|
+
def rsc_plugin_class_name
|
|
114
|
+
generator.__send__(:rsc_plugin_class_name)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def rsc_plugin_import_path
|
|
118
|
+
generator.__send__(:rsc_plugin_import_path)
|
|
119
|
+
end
|
|
112
120
|
end
|
|
113
121
|
|
|
114
122
|
REMOVABLE_WEBPACK_FILES = (MANAGED_WEBPACK_FILE_TEMPLATES.keys +
|
|
@@ -372,8 +380,8 @@ module ReactOnRails
|
|
|
372
380
|
end
|
|
373
381
|
|
|
374
382
|
{
|
|
375
|
-
app_name
|
|
376
|
-
docs_url
|
|
383
|
+
app_name:,
|
|
384
|
+
docs_url:,
|
|
377
385
|
examples: home_page_examples,
|
|
378
386
|
file_hints: home_page_file_hints,
|
|
379
387
|
stack_badges: home_page_stack_badges,
|
|
@@ -963,8 +971,9 @@ module ReactOnRails
|
|
|
963
971
|
# current run omits those options; in that case, we preserve the directory.
|
|
964
972
|
# Templates rely on config[:message] plus a small helper subset exposed by
|
|
965
973
|
# TemplateRenderContext (add_documentation_reference, use_pro?, use_rsc?,
|
|
966
|
-
# shakapacker_version_9_or_higher
|
|
967
|
-
# NoMethodError and are caught below, treating the
|
|
974
|
+
# shakapacker_version_9_or_higher?, rsc_plugin_class_name, rsc_plugin_import_path).
|
|
975
|
+
# Missing method delegates raise NoMethodError and are caught below, treating the
|
|
976
|
+
# file as non-removable.
|
|
968
977
|
# Missing config hash keys return nil silently, so any new config key
|
|
969
978
|
# required by templates must be added to template_doc_config above.
|
|
970
979
|
# Use TemplateRenderContext#erb_binding to avoid leaking method-local
|
|
@@ -1009,13 +1018,13 @@ module ReactOnRails
|
|
|
1009
1018
|
expected_configs = shakapacker_default_configs
|
|
1010
1019
|
|
|
1011
1020
|
# Check if the content matches any of the known default configurations
|
|
1012
|
-
expected_configs.any? { |config| content_matches_template?(content, config, strip_comments:
|
|
1021
|
+
expected_configs.any? { |config| content_matches_template?(content, config, strip_comments:) }
|
|
1013
1022
|
end
|
|
1014
1023
|
|
|
1015
1024
|
def content_matches_template?(content, template, strip_comments: false)
|
|
1016
1025
|
# Normalize whitespace and compare
|
|
1017
|
-
normalize_config_content(content, strip_comments:
|
|
1018
|
-
normalize_config_content(template, strip_comments:
|
|
1026
|
+
normalize_config_content(content, strip_comments:) ==
|
|
1027
|
+
normalize_config_content(template, strip_comments:)
|
|
1019
1028
|
end
|
|
1020
1029
|
|
|
1021
1030
|
def normalize_config_content(content, strip_comments: false)
|
|
@@ -1221,8 +1230,9 @@ module ReactOnRails
|
|
|
1221
1230
|
|
|
1222
1231
|
content = File.read(shakapacker_config_path)
|
|
1223
1232
|
|
|
1224
|
-
#
|
|
1225
|
-
|
|
1233
|
+
# Don't materialize placeholders when any placeholder section already has
|
|
1234
|
+
# a direct or inherited active precompile_hook.
|
|
1235
|
+
return if active_precompile_hook_configured?(content)
|
|
1226
1236
|
|
|
1227
1237
|
# Replace the commented placeholder with the actual value
|
|
1228
1238
|
# Shakapacker 9.x default config has: # precompile_hook: ~
|
|
@@ -5,12 +5,12 @@ module ReactOnRails
|
|
|
5
5
|
module DemoPageConfig # rubocop:disable Metrics/ModuleLength
|
|
6
6
|
def build_hello_world_view_config(component_name:, source_path:, landing_page:, redux:, rsc_demo:)
|
|
7
7
|
{
|
|
8
|
-
component_name
|
|
8
|
+
component_name:,
|
|
9
9
|
title: redux ? "Redux SSR Demo" : "React SSR Demo",
|
|
10
|
-
intro: hello_world_intro(redux:
|
|
11
|
-
highlights: hello_world_highlights(redux:
|
|
12
|
-
file_hints: hello_world_file_hints(source_path
|
|
13
|
-
quick_links: hello_world_quick_links(landing_page
|
|
10
|
+
intro: hello_world_intro(redux:),
|
|
11
|
+
highlights: hello_world_highlights(redux:),
|
|
12
|
+
file_hints: hello_world_file_hints(source_path:, redux:),
|
|
13
|
+
quick_links: hello_world_quick_links(landing_page:, rsc_demo:),
|
|
14
14
|
learning_links: hello_world_learning_links
|
|
15
15
|
}
|
|
16
16
|
end
|
|
@@ -22,7 +22,7 @@ module ReactOnRails
|
|
|
22
22
|
"component response while only client islands ship JavaScript to the browser.",
|
|
23
23
|
highlights: hello_server_highlights,
|
|
24
24
|
file_hints: hello_server_file_hints,
|
|
25
|
-
quick_links: hello_server_quick_links(landing_page
|
|
25
|
+
quick_links: hello_server_quick_links(landing_page:, redux_demo:),
|
|
26
26
|
learning_links: hello_server_learning_links
|
|
27
27
|
}
|
|
28
28
|
end
|
|
@@ -41,7 +41,7 @@ module GeneratorHelper
|
|
|
41
41
|
result != false
|
|
42
42
|
rescue StandardError => e
|
|
43
43
|
say_status :warning, "Could not add packages via package_json gem: #{e.message}", :yellow
|
|
44
|
-
say_status :warning, "Will fall back to direct
|
|
44
|
+
say_status :warning, "Will fall back to direct package manager commands.", :yellow
|
|
45
45
|
false
|
|
46
46
|
end
|
|
47
47
|
end
|
|
@@ -197,6 +197,26 @@ module GeneratorHelper
|
|
|
197
197
|
path.sub(%r{\Aconfig/webpack/}, "config/rspack/")
|
|
198
198
|
end
|
|
199
199
|
|
|
200
|
+
# RSC client-manifest plugin class name for the active bundler.
|
|
201
|
+
# Rspack uses the native `RSCRspackPlugin`; webpack uses `RSCWebpackPlugin`.
|
|
202
|
+
# Both expose the same `{ isServer, clientReferences }` API and emit the same
|
|
203
|
+
# manifest schema, so only the import path and class name differ.
|
|
204
|
+
# Shared by the base webpack-config templates and the standalone RSC migration
|
|
205
|
+
# so both paths scaffold the bundler-correct plugin from one source of truth.
|
|
206
|
+
#
|
|
207
|
+
# @return [String] "RSCRspackPlugin" when rspack, "RSCWebpackPlugin" otherwise
|
|
208
|
+
def rsc_plugin_class_name
|
|
209
|
+
using_rspack? ? "RSCRspackPlugin" : "RSCWebpackPlugin"
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# `react-on-rails-rsc` subpath that exports {#rsc_plugin_class_name}.
|
|
213
|
+
#
|
|
214
|
+
# @return [String] "react-on-rails-rsc/RspackPlugin" when rspack,
|
|
215
|
+
# "react-on-rails-rsc/WebpackPlugin" otherwise
|
|
216
|
+
def rsc_plugin_import_path
|
|
217
|
+
using_rspack? ? "react-on-rails-rsc/RspackPlugin" : "react-on-rails-rsc/WebpackPlugin"
|
|
218
|
+
end
|
|
219
|
+
|
|
200
220
|
# Detect the installed React version from package.json
|
|
201
221
|
# Uses VERSION_PARTS_REGEX pattern from VersionChecker for consistency
|
|
202
222
|
#
|
|
@@ -319,6 +339,24 @@ module GeneratorHelper
|
|
|
319
339
|
@pro_gem_install_deferred = true
|
|
320
340
|
end
|
|
321
341
|
|
|
342
|
+
# The other bundler's plugin class name — the one this project should NOT be using.
|
|
343
|
+
# Used to detect a config left in a mixed state (e.g. a legacy `RSCWebpackPlugin` surviving
|
|
344
|
+
# in an rspack project) so diagnostics can say "wrong bundler plugin" rather than "missing".
|
|
345
|
+
#
|
|
346
|
+
# @return [String] "RSCWebpackPlugin" when rspack, "RSCRspackPlugin" otherwise
|
|
347
|
+
def inactive_rsc_plugin_class_name
|
|
348
|
+
using_rspack? ? "RSCWebpackPlugin" : "RSCRspackPlugin"
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
# Import path for the inactive bundler's plugin — the counterpart to {#rsc_plugin_import_path},
|
|
352
|
+
# used when migrating a legacy config to the active bundler's plugin.
|
|
353
|
+
#
|
|
354
|
+
# @return [String] "react-on-rails-rsc/WebpackPlugin" when rspack,
|
|
355
|
+
# "react-on-rails-rsc/RspackPlugin" otherwise
|
|
356
|
+
def inactive_rsc_plugin_import_path
|
|
357
|
+
using_rspack? ? "react-on-rails-rsc/WebpackPlugin" : "react-on-rails-rsc/RspackPlugin"
|
|
358
|
+
end
|
|
359
|
+
|
|
322
360
|
# NOTE: only the `default:` section is inspected — same assumption as
|
|
323
361
|
# rspack_configured_in_project?. Projects that set `javascript_transpiler`
|
|
324
362
|
# only in per-environment sections (without a `default:` block) will not be
|
|
@@ -15,7 +15,7 @@ module GeneratorMessages
|
|
|
15
15
|
# Read package.json once and reuse for both package-manager detection and the
|
|
16
16
|
# build:test script presence check to avoid a second I/O pass.
|
|
17
17
|
package_json = read_package_json(app_root)
|
|
18
|
-
package_manager = detect_package_manager(app_root
|
|
18
|
+
package_manager = detect_package_manager(app_root:, package_json:)
|
|
19
19
|
ci_status = if ci_workflow_generated
|
|
20
20
|
"A GitHub Actions workflow has been generated at .github/workflows/ci.yml."
|
|
21
21
|
else
|
|
@@ -30,7 +30,7 @@ module GeneratorMessages
|
|
|
30
30
|
end
|
|
31
31
|
manual_build_command = shakapacker_build_command(
|
|
32
32
|
env: "RAILS_ENV=test NODE_ENV=test",
|
|
33
|
-
app_root
|
|
33
|
+
app_root:,
|
|
34
34
|
environment: "test"
|
|
35
35
|
)
|
|
36
36
|
|
|
@@ -37,8 +37,8 @@ module GeneratorMessages
|
|
|
37
37
|
# wants detection to fall through directly to lockfile heuristics.
|
|
38
38
|
def detect_package_manager(app_root: Dir.pwd, package_json: PACKAGE_JSON_UNSET)
|
|
39
39
|
detect_package_manager_with_source(
|
|
40
|
-
app_root
|
|
41
|
-
package_json:
|
|
40
|
+
app_root:,
|
|
41
|
+
package_json:
|
|
42
42
|
).first
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -52,13 +52,13 @@ module GeneratorMessages
|
|
|
52
52
|
return [env_package_manager, :env] if supported_package_manager?(env_package_manager)
|
|
53
53
|
|
|
54
54
|
content = package_json_content(
|
|
55
|
-
app_root
|
|
56
|
-
package_json:
|
|
55
|
+
app_root:,
|
|
56
|
+
package_json:
|
|
57
57
|
)
|
|
58
58
|
pm_from_json = content ? package_manager_name_from_content(content) : nil
|
|
59
59
|
return [pm_from_json, :package_json] if pm_from_json
|
|
60
60
|
|
|
61
|
-
pm_from_lockfile = detect_package_manager_from_lockfiles(app_root:
|
|
61
|
+
pm_from_lockfile = detect_package_manager_from_lockfiles(app_root:)
|
|
62
62
|
return [pm_from_lockfile, :lockfile] if pm_from_lockfile
|
|
63
63
|
|
|
64
64
|
["npm", :default]
|
|
@@ -84,8 +84,8 @@ module GeneratorMessages
|
|
|
84
84
|
# package_json: nil to preserve a cached missing/unreadable read.
|
|
85
85
|
def package_manager_declared?(manager:, app_root: Dir.pwd, package_json: PACKAGE_JSON_UNSET)
|
|
86
86
|
content = package_json_content(
|
|
87
|
-
app_root
|
|
88
|
-
package_json:
|
|
87
|
+
app_root:,
|
|
88
|
+
package_json:
|
|
89
89
|
)
|
|
90
90
|
return false unless content
|
|
91
91
|
|
|
@@ -99,12 +99,12 @@ module GeneratorMessages
|
|
|
99
99
|
# that's not on disk (e.g. `packageManager: pnpm` without `pnpm-lock.yaml`, which
|
|
100
100
|
# breaks `actions/setup-node`'s cache step).
|
|
101
101
|
def lockfile_for_manager?(package_manager, app_root: Dir.pwd)
|
|
102
|
-
!lockfile_filename_for(package_manager, app_root:
|
|
102
|
+
!lockfile_filename_for(package_manager, app_root:).nil?
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
def detect_package_manager_from_lockfiles(app_root: Dir.pwd)
|
|
106
106
|
LOCKFILE_CANDIDATES_BY_MANAGER.keys.find do |pm|
|
|
107
|
-
lockfile_for_manager?(pm, app_root:
|
|
107
|
+
lockfile_for_manager?(pm, app_root:)
|
|
108
108
|
end
|
|
109
109
|
end
|
|
110
110
|
|
|
@@ -7,7 +7,7 @@ module GeneratorMessages
|
|
|
7
7
|
private
|
|
8
8
|
|
|
9
9
|
def build_shakapacker_status_section(shakapacker_just_installed: false, app_root: Dir.pwd)
|
|
10
|
-
version_warning = check_shakapacker_version_warning(app_root:
|
|
10
|
+
version_warning = check_shakapacker_version_warning(app_root:)
|
|
11
11
|
if shakapacker_just_installed
|
|
12
12
|
base = <<~SHAKAPACKER
|
|
13
13
|
|
|
@@ -58,13 +58,13 @@ module GeneratorMessages
|
|
|
58
58
|
rsc: false, shakapacker_just_installed: false, landing_page: false,
|
|
59
59
|
ci_workflow_generated: false, app_root: Dir.pwd)
|
|
60
60
|
process_manager_section = build_process_manager_section
|
|
61
|
-
testing_section = build_testing_section(app_root:
|
|
62
|
-
ci_section = build_ci_section(app_root
|
|
63
|
-
package_manager = detect_package_manager(app_root:
|
|
64
|
-
shakapacker_status = build_shakapacker_status_section(shakapacker_just_installed
|
|
65
|
-
app_root:
|
|
66
|
-
render_example = build_render_example(component_name
|
|
67
|
-
render_label = build_render_label(route
|
|
61
|
+
testing_section = build_testing_section(app_root:)
|
|
62
|
+
ci_section = build_ci_section(app_root:, ci_workflow_generated:)
|
|
63
|
+
package_manager = detect_package_manager(app_root:)
|
|
64
|
+
shakapacker_status = build_shakapacker_status_section(shakapacker_just_installed:,
|
|
65
|
+
app_root:)
|
|
66
|
+
render_example = build_render_example(component_name:, route:, rsc:)
|
|
67
|
+
render_label = build_render_label(route:, rsc:)
|
|
68
68
|
normalized_route = route.to_s.sub(%r{\A/+}, "")
|
|
69
69
|
visit_url = if landing_page || normalized_route.empty?
|
|
70
70
|
"http://localhost:3000"
|
|
@@ -294,7 +294,7 @@ module ReactOnRails
|
|
|
294
294
|
package_json = GeneratorMessages.read_package_json(destination_root)
|
|
295
295
|
package_manager = GeneratorMessages.detect_package_manager(
|
|
296
296
|
app_root: destination_root,
|
|
297
|
-
package_json:
|
|
297
|
+
package_json:
|
|
298
298
|
)
|
|
299
299
|
# Scope the lockfile check to the detected manager: a generic "any lockfile exists" check
|
|
300
300
|
# would emit `cache: "pnpm"` in CI when only `yarn.lock` is on disk, breaking setup-node.
|
|
@@ -307,16 +307,16 @@ module ReactOnRails
|
|
|
307
307
|
GeneratorMessages.package_manager_declared?(
|
|
308
308
|
app_root: destination_root,
|
|
309
309
|
manager: "pnpm",
|
|
310
|
-
package_json:
|
|
310
|
+
package_json:
|
|
311
311
|
)
|
|
312
312
|
has_active_record = File.exist?(File.join(destination_root, "config/database.yml"))
|
|
313
313
|
has_rspec = File.exist?(File.join(destination_root, "spec/rails_helper.rb")) ||
|
|
314
314
|
File.exist?(File.join(destination_root, "spec/spec_helper.rb"))
|
|
315
315
|
template("templates/base/base/.github/workflows/ci.yml.tt", ci_path,
|
|
316
|
-
{ package_manager
|
|
317
|
-
pnpm_version_declared
|
|
316
|
+
{ package_manager:, has_lockfile:,
|
|
317
|
+
pnpm_version_declared:,
|
|
318
318
|
pnpm_fallback_version: CI_PNPM_FALLBACK_VERSION,
|
|
319
|
-
has_active_record
|
|
319
|
+
has_active_record:, has_rspec:,
|
|
320
320
|
precompile_hook_command: shakapacker_precompile_hook_command(environment: "test") })
|
|
321
321
|
@ci_workflow_generated = true
|
|
322
322
|
end
|
|
@@ -442,7 +442,7 @@ module ReactOnRails
|
|
|
442
442
|
content = JSON.parse(original_text)
|
|
443
443
|
content["scripts"] = existing_scripts.merge(scripts_to_add)
|
|
444
444
|
indent = original_text[/\A\{\n(\s+)/, 1] || " "
|
|
445
|
-
"#{JSON.pretty_generate(content, indent:
|
|
445
|
+
"#{JSON.pretty_generate(content, indent:)}\n"
|
|
446
446
|
end
|
|
447
447
|
|
|
448
448
|
def ensure_jsx_in_js_compatibility
|
|
@@ -690,8 +690,8 @@ module ReactOnRails
|
|
|
690
690
|
end
|
|
691
691
|
|
|
692
692
|
GeneratorMessages.add_info(GeneratorMessages.helpful_message_after_installation(
|
|
693
|
-
component_name
|
|
694
|
-
route
|
|
693
|
+
component_name:,
|
|
694
|
+
route:,
|
|
695
695
|
pro: use_pro?,
|
|
696
696
|
rsc: use_rsc?,
|
|
697
697
|
shakapacker_just_installed: shakapacker_just_installed?,
|