Skip to content

Commit 093e4fe

Browse files
justin808claude
andcommitted
Fix CI failures for Shakapacker 8+ compatibility
- Updated script/convert to use Shakapacker 8.0.0 instead of 6.6.0 - Removed webpacker.yml file move since staying with shakapacker.yml - Updated React version to 18.0.0 (minimum supported since PropTypes removed) - Kept modern JSX transform and ReScript configuration - Added rake_tasks loading to engine for react_on_rails:generate_packs task - Fixed file manager test to properly stub File.delete return value All changes align with the architectural decision to make Shakapacker 8+ an explicit dependency and drop support for older versions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 3502028 commit 093e4fe

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

lib/react_on_rails/engine.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@ class Engine < ::Rails::Engine
88
VersionChecker.build.log_if_gem_and_node_package_versions_differ
99
ReactOnRails::ServerRenderingPool.reset_pool
1010
end
11+
12+
rake_tasks do
13+
path = File.join(File.dirname(__FILE__), "..", "tasks", "*.rake")
14+
Dir[path].each { |f| load f }
15+
end
1116
end
1217
end

script/convert

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ def move(old_path, new_path)
1414
File.rename(old_path, new_path)
1515
end
1616

17-
move("../spec/dummy/config/shakapacker.yml", "../spec/dummy/config/webpacker.yml")
17+
# Keep shakapacker.yml since we're using Shakapacker 8+
18+
# move("../spec/dummy/config/shakapacker.yml", "../spec/dummy/config/webpacker.yml")
1819

19-
# Shakapacker
20-
gsub_file_content("../Gemfile.development_dependencies", /gem "shakapacker", "[^"]*"/, 'gem "shakapacker", "6.6.0"')
21-
gsub_file_content("../spec/dummy/package.json", /"shakapacker": "[^"]*",/, '"shakapacker": "6.6.0",')
20+
# Shakapacker - use minimum supported version (8.0)
21+
gsub_file_content("../Gemfile.development_dependencies", /gem "shakapacker", "[^"]*"/, 'gem "shakapacker", "8.0.0"')
22+
gsub_file_content("../spec/dummy/package.json", /"shakapacker": "[^"]*",/, '"shakapacker": "8.0.0",')
2223

2324
# The below packages don't work on the oldest supported Node version and aren't needed there anyway
2425
gsub_file_content("../package.json", /"[^"]*eslint[^"]*": "[^"]*",?/, "")
@@ -31,25 +32,26 @@ gsub_file_content("../package.json", %r{"@testing-library/[^"]*": "[^"]*",}, "")
3132
# Clean up any trailing commas before closing braces
3233
gsub_file_content("../package.json", /,(\s*})/, "\\1")
3334

34-
# Switch to the oldest supported React version
35-
gsub_file_content("../package.json", /"react": "[^"]*",/, '"react": "16.14.0",')
36-
gsub_file_content("../package.json", /"react-dom": "[^"]*",/, '"react-dom": "16.14.0",')
37-
gsub_file_content("../spec/dummy/package.json", /"react": "[^"]*",/, '"react": "16.14.0",')
38-
gsub_file_content("../spec/dummy/package.json", /"react-dom": "[^"]*",/, '"react-dom": "16.14.0",')
35+
# Switch to minimum supported React version (React 18 since we removed PropTypes)
36+
gsub_file_content("../package.json", /"react": "[^"]*",/, '"react": "18.0.0",')
37+
gsub_file_content("../package.json", /"react-dom": "[^"]*",/, '"react-dom": "18.0.0",')
38+
gsub_file_content("../spec/dummy/package.json", /"react": "[^"]*",/, '"react": "18.0.0",')
39+
gsub_file_content("../spec/dummy/package.json", /"react-dom": "[^"]*",/, '"react-dom": "18.0.0",')
3940
gsub_file_content(
4041
"../package.json",
4142
"jest node_package/tests",
4243
'jest node_package/tests --testPathIgnorePatterns=\".*(RSC|stream|' \
4344
'registerServerComponent|serverRenderReactComponent|SuspenseHydration).*\"'
4445
)
45-
gsub_file_content("../tsconfig.json", "react-jsx", "react")
46-
gsub_file_content("../spec/dummy/babel.config.js", "runtime: 'automatic'", "runtime: 'classic'")
47-
# https://rescript-lang.org/docs/react/latest/migrate-react#configuration
48-
gsub_file_content("../spec/dummy/rescript.json", '"version": 4', '"version": 4, "mode": "classic"')
49-
# Find all files under app-react16 and replace the React 19 versions
50-
Dir.glob(File.expand_path("../spec/dummy/**/app-react16/**/*.*", __dir__)).each do |file|
51-
move(file, file.gsub("-react16", ""))
52-
end
46+
# Keep modern JSX transform for React 18+
47+
# gsub_file_content("../tsconfig.json", "react-jsx", "react")
48+
# gsub_file_content("../spec/dummy/babel.config.js", "runtime: 'automatic'", "runtime: 'classic'")
49+
# Keep modern ReScript configuration for React 18+
50+
# gsub_file_content("../spec/dummy/rescript.json", '"version": 4', '"version": 4, "mode": "classic"')
51+
# Skip React 16 file replacements since we're using React 18+
52+
# Dir.glob(File.expand_path("../spec/dummy/**/app-react16/**/*.*", __dir__)).each do |file|
53+
# move(file, file.gsub("-react16", ""))
54+
# end
5355

5456
gsub_file_content("../spec/dummy/config/webpack/commonWebpackConfig.js", /generateWebpackConfig(\(\))?/,
5557
"webpackConfig")

spec/react_on_rails/dev/file_manager_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
allow(File).to receive(:exist?).with("tmp/sockets/overmind.sock").and_return(false)
3333
allow(File).to receive(:exist?).with("tmp/pids/server.pid").and_return(false)
3434

35-
expect(File).to receive(:delete).with(".overmind.sock")
35+
expect(File).to receive(:delete).with(".overmind.sock").and_return(nil)
3636

3737
result = described_class.cleanup_stale_files
3838
expect(result).to be true

0 commit comments

Comments
 (0)