-
-
Notifications
You must be signed in to change notification settings - Fork 632
Automate Pro generator gem/package swap and import updates #2822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c14431e
4343d86
6fda382
97ba6ee
eb33f31
55d2b39
90a48c3
bbce91a
3770f5c
f6a42ec
aa86193
5bcf491
28747cb
45da4bb
7970be6
88fe947
d68f7db
eed2fb0
07b9593
bd71df2
88ca44c
97252bb
237ceb0
84c806d
d84f57e
341a990
919a1b1
95efd3f
24bbb51
422ff98
27137fc
62040f9
c9d36f8
b78c4dd
6be8925
7c6cd2b
7c0ecb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,6 +125,10 @@ module JsDependencyManager | |
| react-on-rails-rsc | ||
| ].freeze | ||
|
|
||
| # RSC package releases follow the React 19.0.x line (independent from gem versioning). | ||
| RSC_REACT_VERSION_RANGE = "~19.0.4" | ||
| RSC_PACKAGE_VERSION_PIN = "19.0.4" | ||
|
justin808 marked this conversation as resolved.
justin808 marked this conversation as resolved.
|
||
|
|
||
| private | ||
|
|
||
| def setup_js_dependencies | ||
|
|
@@ -218,7 +222,7 @@ def add_react_dependencies | |
| # RSC requires React 19.0.x specifically (not 19.1.x or later) | ||
| # Pin to ~19.0.4 to allow patch updates while staying within 19.0.x | ||
| react_deps = if respond_to?(:use_rsc?) && use_rsc? | ||
| %w[react@~19.0.4 react-dom@~19.0.4 prop-types] | ||
| ["react@#{RSC_REACT_VERSION_RANGE}", "react-dom@#{RSC_REACT_VERSION_RANGE}", "prop-types"] | ||
| else | ||
| REACT_DEPENDENCIES | ||
| end | ||
|
|
@@ -383,13 +387,29 @@ def pro_packages_with_version | |
|
|
||
| def add_rsc_dependencies | ||
| say "Installing React Server Components dependencies..." | ||
| return if add_packages(RSC_DEPENDENCIES) | ||
| rsc_packages, used_version_pins = rsc_packages_with_version | ||
| return if add_packages(rsc_packages) | ||
|
|
||
| manual_install_packages = rsc_packages | ||
| if used_version_pins | ||
| warning_msg = "Could not install version-pinned RSC dependency. Retrying latest available package." | ||
| say_status :warning, | ||
| warning_msg, | ||
| :yellow | ||
| GeneratorMessages.add_warning( | ||
| "Warning: #{warning_msg} " \ | ||
| "The installed react-on-rails-rsc version may not match the expected compatibility pin." | ||
| ) | ||
| return if add_packages(RSC_DEPENDENCIES) | ||
|
justin808 marked this conversation as resolved.
|
||
|
|
||
| manual_install_packages = RSC_DEPENDENCIES | ||
| end | ||
|
|
||
| GeneratorMessages.add_warning(<<~MSG.strip) | ||
| ⚠️ Failed to add React Server Components dependencies. | ||
|
|
||
| You can install them manually by running: | ||
| npm install #{RSC_DEPENDENCIES.join(' ')} | ||
| npm install #{manual_install_packages.join(' ')} | ||
| MSG | ||
| rescue StandardError => e | ||
| GeneratorMessages.add_warning(<<~MSG.strip) | ||
|
|
@@ -400,6 +420,12 @@ def add_rsc_dependencies | |
| MSG | ||
| end | ||
|
|
||
| # Returns [pinned_packages, used_version_pins]. used_version_pins is always true here; | ||
| # subclasses may override to return [packages, false] when pinning should be skipped. | ||
| def rsc_packages_with_version | ||
| [RSC_DEPENDENCIES.map { |pkg| "#{pkg}@#{RSC_PACKAGE_VERSION_PIN}" }, true] | ||
|
justin808 marked this conversation as resolved.
|
||
| end | ||
|
Comment on lines
+423
to
+427
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Subclasses may override" is pre-emptive documentation There are currently no subclasses of If this override hook is genuinely part of the design, consider either:
The constant
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the suggestion. I’m keeping the comment for now as intentional context for the extension point; no functional issue to address in this PR. |
||
|
|
||
| def remove_base_package_if_present | ||
| pj = package_json | ||
| return unless pj | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.