-
-
Notifications
You must be signed in to change notification settings - Fork 638
Run "link-source" script in development environment only at node renderer package #1884
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
Run "link-source" script in development environment only at node renderer package #1884
Conversation
…erer package don't run the "link-source" script on preinstall of the node renderer package when it's installed at a client project and not running in dev environment it depends on checking if yarn.lock file exist at installing directory to check if it's in dev environment
WalkthroughChanged the Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant NPM as npm (preinstall)
participant Shell as Shell
participant LinkSrc as link-source
participant Yalc as yalc
NPM->>Shell: run preinstall
Shell->>Shell: test -f yarn.lock
alt yarn.lock missing
Shell-->>NPM: exit 0 (no-op)
else yarn.lock present
Shell->>LinkSrc: yarn run link-source
LinkSrc-->>Shell: success/failure
Shell->>Yalc: yalc add --link react-on-rails
Yalc-->>Shell: success/failure
Shell-->>NPM: propagate exit status
end
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{js,jsx,ts,tsx,css,scss,json,yml,yaml,md}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
🔇 Additional comments (1)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
react_on_rails_pro/package.json (1)
106-106: Add a comment documenting the conditional behavior.This script's logic (checking yarn.lock to detect development vs. client installation) is not self-evident. A brief inline comment will help future maintainers understand why the check exists.
- "preinstall": "(test -f yarn.lock && yarn run link-source && yalc add --link react-on-rails) || true", + "preinstall": "test -f yarn.lock || exit 0; yarn run link-source && yalc add --link react-on-rails",And add a comment in an adjacent line or in the repo documentation explaining: "Only link source in development (presence of yarn.lock indicates development environment, not a client installation in node_modules)."
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
react_on_rails_pro/package.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx,css,scss,json,yml,yaml,md}
📄 CodeRabbit inference engine (CLAUDE.md)
Prettier is the sole authority for formatting all non-Ruby files; never manually format them
Files:
react_on_rails_pro/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: build-dummy-app-webpack-test-bundles
- GitHub Check: build
- GitHub Check: build-dummy-app-webpack-test-bundles (3.2, 20)
- GitHub Check: build-dummy-app-webpack-test-bundles (3.4, 22)
- GitHub Check: rspec-package-tests (3.4, latest)
- GitHub Check: rspec-package-tests (3.2, latest)
- GitHub Check: rspec-package-tests (3.2, minimum)
- GitHub Check: rspec-package-tests (3.4, minimum)
- GitHub Check: lint-js-and-ruby
- GitHub Check: build-dummy-app-webpack-test-bundles
Code Review - PR #1884Thank you for working on this fix! This PR addresses an important issue where the ✅ Positive Aspects
|
Code Review - PR #1884: Run "link-source" script in development environment onlyThank you for working on this fix! This PR addresses an important issue where the ✅ Positive Aspects
|
|
Solved in #1873. |
Code Review SummaryThank you for identifying and working on this issue! However, I notice that PR #1873 has already solved this problem with a superior implementation. Current Solution (PR #1873)The repository now uses a Node.js script (script/preinstall.js) instead of shell commands that checks if the package is installed inside node_modules. This approach is much more reliable than the yarn.lock check because:
Issues with This PR ApproachThe test -f yarn.lock method has several reliability problems: 1. False Positives - Client projects often have their own yarn.lock file, so the script would incorrectly run in client installations 2. Working Directory Assumption - The check depends on which directory npm/yarn uses as cwd during preinstall, which can vary between package managers and installation contexts 3. Monorepo Confusion - Monorepos may have multiple yarn.lock files at different levels, so the check does not reliably distinguish dev vs. production contexts Additional Concerns (Per CLAUDE.md Requirements)Even if this approach were viable, the PR is missing mandatory requirements:
RecommendationThis PR should be closed in favor of the existing solution in PR #1873. The preinstall.js approach is more reliable, easier to understand and maintain, already implemented and tested, and cross-platform compatible. Thank you for bringing attention to this issue! While this particular implementation will not be merged, your identification of the problem was valuable and has already been addressed. Status: ❌ Request to Close (superseded by #1873) |
Code Review: PR #1884Thank you for working on this issue! I've reviewed the PR and have some important findings to share. 🚨 Critical Issue: PR is OutdatedThe problem this PR attempts to solve has already been addressed in a better way on the master branch. The PR diff shows a change to an inline bash script in "preinstall": "test -f yarn.lock || exit 0; yarn run link-source && yalc add --link react-on-rails"However, the current master branch (react_on_rails_pro/package.json:107) already uses a Node.js script: "preinstall": "node ./script/preinstall.js"This
Analysis of the Proposed ApproachThe
RecommendationThis PR should be closed as the issue has already been resolved with a superior implementation in commit that introduced Additional Notes
For MaintainersPlease confirm if the Code Style Notes (per CLAUDE.md):
|
PR Review: Run "link-source" script in development environment onlyOverviewThis PR aims to prevent the Critical Issue: PR Appears to Target Outdated CodeThe PR diff shows changes to an inline shell script in const inNodeModules = __dirname.split(path.sep).includes('node_modules');
if (inNodeModules) {
console.log('preinstall: running inside node_modules — skipping link steps.');
process.exit(0);
}This is a more reliable approach than checking for
Issues with the PR's Proposed ApproachThe PR suggests using Problems:
RecommendationIt appears this PR may have been created against an older version of the code. The current implementation in Suggested Actions:
Additional Notes from CLAUDE.mdPer the project guidelines:
Questions for the Author
Summary: The current codebase already has a more robust solution to this problem. Please verify if this PR is still needed and if so, rebase against the latest code and provide test cases demonstrating the issue. |
Code Review: PR #1884Thank you for working on this issue! I've reviewed the changes and have some important feedback. Critical Issue: PR Appears OutdatedThe main branch already has a more robust solution that supersedes this PR's approach. The current Current main branch solution ( "preinstall": "node ./script/preinstall.js"The
Issues with the PR's Approach1. Unreliable Detection Method test -f yarn.lock || exit 0This approach has several problems:
2. Platform Compatibility 3. Error Handling RecommendationThis PR should be closed as the issue it addresses has already been solved more robustly in the main branch via If you'd like to contribute further improvements:
Why
|
Code Review for PR #1884SummaryThis PR attempts to fix an issue where the Critical Issue: PR Appears Outdated
|
PR Review: Run "link-source" script in development environment onlyThank you for this contribution! However, after reviewing the code, I've identified that this PR appears to be outdated and the problem has already been solved in a better way. Current State vs. PR ChangesWhat this PR proposes: "preinstall": "test -f yarn.lock || exit 0; yarn run link-source && yalc add --link react-on-rails"What's already in master: "preinstall": "node ./script/preinstall.js"The codebase already has a Why the Current Solution is BetterThe existing
Issues with the PR Approach
RecommendationThis PR should be closed as the issue has been resolved more comprehensively in commit that introduced If you're experiencing issues with the current preinstall behavior, please:
Additional NotesPer the CLAUDE.md guidelines:
Thank you for contributing! While this particular change isn't needed, your attention to the development workflow issues is appreciated. |
Code Review - PR #1884OverviewThis PR attempts to prevent the
|
|
Solved in #1873. |
…erer package
don't run the "link-source" script on preinstall of the node renderer package when it's installed at a client project and not running in dev environment
it depends on checking if yarn.lock file exist at installing directory to check if it's in dev environment
Summary
Remove this paragraph and provide a general description of the code changes in your pull
request... were there any bugs you had fixed? If so, mention them. If
these bugs have open GitHub issues, be sure to tag them here as well,
to keep the conversation linked together.
Pull Request checklist
Remove this line after checking all the items here. If the item is not applicable to the PR, both check it out and wrap it by
~.Add the CHANGELOG entry at the top of the file.
Other Information
Remove this paragraph and mention any other important and relevant information such as benchmarks.
This change is
Summary by CodeRabbit