Skip to content

Commit 12fc9d2

Browse files
justin808claude
andcommitted
Address PR review comments
- Update @types/react and @types/react-dom to v19 to match React 19 runtime - Fix Gemfile regex to handle multi-line gem declarations - Document why bundle isolation is only needed for minimum version examples - Improve script/convert fallback logic to handle all file path patterns with warning when file not found 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3ca2f9f commit 12fc9d2

File tree

4 files changed

+47
-26
lines changed

4 files changed

+47
-26
lines changed

pnpm-lock.yaml

Lines changed: 16 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react_on_rails/rakelib/run_rspec.rake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ end
166166
# :rspec_args - additional rspec arguments (default: "")
167167
# :env_vars - additional environment variables (default: "")
168168
# :unbundled - run with unbundled_sh_in_dir for Bundler isolation (default: false)
169+
# This is required for minimum version examples because they have different
170+
# gem versions (e.g., Shakapacker 8.2.0) pinned in their Gemfile than the
171+
# parent workspace (Shakapacker 9.x). Without bundle isolation, Bundler
172+
# would inherit the parent's gem resolution and use the wrong versions.
173+
# Latest version examples don't need this because they use the same versions
174+
# as the parent workspace.
169175
def run_tests_in(dir, options = {})
170176
path = calc_path(dir)
171177

react_on_rails/rakelib/shakapacker_examples.rake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ namespace :shakapacker_examples do # rubocop:disable Metrics/BlockLength
5959
if File.exist?(gemfile_path)
6060
gemfile_content = File.read(gemfile_path)
6161
# Replace any shakapacker gem line with exact version pin
62+
# Handle both single-line: gem 'shakapacker', '>= 8.2.0'
63+
# And multi-line declarations:
64+
# gem 'shakapacker',
65+
# '>= 8.2.0'
6266
gemfile_content = gemfile_content.gsub(
63-
/gem ['"]shakapacker['"].*$/,
67+
/gem ['"]shakapacker['"][^\n]*(?:\n\s+[^g\n][^\n]*)*$/m,
6468
"gem 'shakapacker', '#{ExampleType::MINIMUM_SHAKAPACKER_VERSION}'"
6569
)
6670
File.write(gemfile_path, gemfile_content)

script/convert

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,26 @@ def gsub_file_content(path, old_content, new_content)
1515
# Support both old structure (files at root) and new structure (files in react_on_rails/)
1616
# This allows the script to work before and after the monorepo reorganization
1717
unless File.exist?(path)
18-
# Try the old location by removing one level of nesting
19-
old_path = path.sub(%r{/react_on_rails/Gemfile}, "/Gemfile")
20-
path = old_path if File.exist?(old_path)
18+
# Try alternate locations:
19+
# 1. For react_on_rails subdirectory paths, try removing that nesting
20+
# 2. For packages/* paths, try the old node_package/ location
21+
alternate_paths = [
22+
path.sub(%r{/react_on_rails/}, "/"),
23+
path.sub(%r{/packages/react-on-rails/}, "/node_package/"),
24+
path.sub(%r{/packages/react-on-rails-pro/}, "/react_on_rails_pro/node_package/")
25+
]
26+
27+
alternate_paths.each do |alt_path|
28+
if File.exist?(alt_path)
29+
path = alt_path
30+
break
31+
end
32+
end
33+
end
34+
35+
unless File.exist?(path)
36+
warn "Warning: File not found: #{path}"
37+
return
2138
end
2239

2340
content = File.binread(path)

0 commit comments

Comments
 (0)