Skip to content

Commit a13cba9

Browse files
justin808claude
andcommitted
Extract React version check to separate script file
Address code review feedback: - Move inline version detection to scripts/check-react-version.cjs for better clarity and maintainability - Use .cjs extension since the parent package is ESM and we need require() - Add root Gemfile.lock to .gitignore (it's a delegate to react_on_rails/Gemfile) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 0372fbe commit a13cba9

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Root Gemfile.lock (delegates to react_on_rails/Gemfile, lock is there)
2+
/Gemfile.lock
3+
14
.bundle/
25
/.yardoc
36
/_yardoc/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Check if React version supports RSC features (React 19+).
3+
* Exits with code 0 if React < 19 (skip RSC tests).
4+
* Exits with code 1 if React >= 19 (run RSC tests).
5+
*
6+
* This is a CommonJS file (.cjs) because it needs to use require()
7+
* and the parent package has "type": "module".
8+
*/
9+
const v = require('react/package.json').version;
10+
11+
const majorVersion = parseInt(v, 10);
12+
13+
if (majorVersion < 19) {
14+
console.log(`RSC tests skipped (requires React 19+, found ${v})`);
15+
process.exit(0);
16+
}
17+
18+
// Exit with code 1 so the || chain continues to run Jest
19+
process.exit(1);

0 commit comments

Comments
 (0)