Update bin/shakapacker to auto-generate packs#1630
Conversation
WalkthroughThe changes primarily focus on enhancing the development environment setup by adding the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
spec/dummy/Gemfile.lockis excluded by!**/*.lockspec/dummy/yarn.lockis excluded by!**/*.lock
Files selected for processing (4)
- Gemfile.development_dependencies (1 hunks)
- spec/dummy/Procfile.dev (1 hunks)
- spec/dummy/bin/shakapacker (1 hunks)
- spec/dummy/bin/shakapacker-dev-server (1 hunks)
Files skipped from review due to trivial changes (3)
- Gemfile.development_dependencies
- spec/dummy/Procfile.dev
- spec/dummy/bin/shakapacker-dev-server
Additional comments not posted (1)
spec/dummy/bin/shakapacker (1)
12-13: Ensure that therakegem is included in the Gemfile to avoid runtime errors.
| # Recommendation is to generate packs before compilation. | ||
| # SERVER_BUNDLE_ONLY is true when also running the bin/shakapacker-dev-server, | ||
| # so no need to run twice. | ||
| unless ENV["SERVER_BUNDLE_ONLY"] == "true" | ||
| Rake.application.load_rakefile | ||
| Rake::Task["react_on_rails:generate_packs"].invoke | ||
| end |
There was a problem hiding this comment.
The conditional execution logic is clear and well-commented.
However, consider adding error handling for the Rake task invocation to manage potential failures gracefully.
- Rake::Task["react_on_rails:generate_packs"].invoke
+ begin
+ Rake::Task["react_on_rails:generate_packs"].invoke
+ rescue Exception => e
+ puts "Failed to generate packs: #{e.message}"
+ exit 1
+ endCommittable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Recommendation is to generate packs before compilation. | |
| # SERVER_BUNDLE_ONLY is true when also running the bin/shakapacker-dev-server, | |
| # so no need to run twice. | |
| unless ENV["SERVER_BUNDLE_ONLY"] == "true" | |
| Rake.application.load_rakefile | |
| Rake::Task["react_on_rails:generate_packs"].invoke | |
| end | |
| # Recommendation is to generate packs before compilation. | |
| # SERVER_BUNDLE_ONLY is true when also running the bin/shakapacker-dev-server, | |
| # so no need to run twice. | |
| unless ENV["SERVER_BUNDLE_ONLY"] == "true" | |
| Rake.application.load_rakefile | |
| begin | |
| Rake::Task["react_on_rails:generate_packs"].invoke | |
| rescue Exception => e | |
| puts "Failed to generate packs: #{e.message}" | |
| exit 1 | |
| end | |
| end |
…e convention The spec/dummy used `SERVER_BUNDLE_ONLY=true` while the generator template and all other Procfiles use `=yes`. The inconsistency was introduced accidentally in PR #1630 and has no functional impact (webpack checks truthiness, not exact string), but aligning with the template convention keeps the spec/dummy representative of what users get. Closes #2409 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ention (#2922) ## Summary - Aligns `spec/dummy/Procfile.dev` to use `SERVER_BUNDLE_ONLY=yes` instead of `=true`, matching the generator template and all other Procfiles in the codebase - Also fixes `CLIENT_BUNDLE_ONLY=true` → `=yes` in the RSC "how it works" doc, which had the same inconsistency - Both inconsistencies are purely cosmetic — webpack configs check truthiness (`if (process.env.X)`), not exact string equality ## Context - The `SERVER_BUNDLE_ONLY` inconsistency was introduced accidentally in PR #1630 (June 2024) when the value was changed from `=yes` to `=true` without review - The `CLIENT_BUNDLE_ONLY` inconsistency in `docs/pro/react-server-components/how-react-server-components-work.md` was found during investigation — all other `CLIENT_BUNDLE_ONLY` usage (`server_manager.rb`, specs, other docs) uses `=yes` Closes #2409 ## Test plan - [x] CI passes (no functional change — both `"yes"` and `"true"` are truthy in JS) - [x] Verify `spec/dummy/Procfile.dev` now matches the template convention - [x] Verify RSC doc commands match the codebase convention 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated development/build configuration to adjust a server bundle setting for consistent local tooling behavior. * Updated documentation to reflect the revised build command and clarify the local development workflow. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
…ention (#2922) ## Summary - Aligns `spec/dummy/Procfile.dev` to use `SERVER_BUNDLE_ONLY=yes` instead of `=true`, matching the generator template and all other Procfiles in the codebase - Also fixes `CLIENT_BUNDLE_ONLY=true` → `=yes` in the RSC "how it works" doc, which had the same inconsistency - Both inconsistencies are purely cosmetic — webpack configs check truthiness (`if (process.env.X)`), not exact string equality ## Context - The `SERVER_BUNDLE_ONLY` inconsistency was introduced accidentally in PR #1630 (June 2024) when the value was changed from `=yes` to `=true` without review - The `CLIENT_BUNDLE_ONLY` inconsistency in `docs/pro/react-server-components/how-react-server-components-work.md` was found during investigation — all other `CLIENT_BUNDLE_ONLY` usage (`server_manager.rb`, specs, other docs) uses `=yes` Closes #2409 ## Test plan - [x] CI passes (no functional change — both `"yes"` and `"true"` are truthy in JS) - [x] Verify `spec/dummy/Procfile.dev` now matches the template convention - [x] Verify RSC doc commands match the codebase convention 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated development/build configuration to adjust a server bundle setting for consistent local tooling behavior. * Updated documentation to reflect the revised build command and clarify the local development workflow. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
…ention (#2922) ## Summary - Aligns `spec/dummy/Procfile.dev` to use `SERVER_BUNDLE_ONLY=yes` instead of `=true`, matching the generator template and all other Procfiles in the codebase - Also fixes `CLIENT_BUNDLE_ONLY=true` → `=yes` in the RSC "how it works" doc, which had the same inconsistency - Both inconsistencies are purely cosmetic — webpack configs check truthiness (`if (process.env.X)`), not exact string equality ## Context - The `SERVER_BUNDLE_ONLY` inconsistency was introduced accidentally in PR #1630 (June 2024) when the value was changed from `=yes` to `=true` without review - The `CLIENT_BUNDLE_ONLY` inconsistency in `docs/pro/react-server-components/how-react-server-components-work.md` was found during investigation — all other `CLIENT_BUNDLE_ONLY` usage (`server_manager.rb`, specs, other docs) uses `=yes` Closes #2409 ## Test plan - [x] CI passes (no functional change — both `"yes"` and `"true"` are truthy in JS) - [x] Verify `spec/dummy/Procfile.dev` now matches the template convention - [x] Verify RSC doc commands match the codebase convention 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated development/build configuration to adjust a server bundle setting for consistent local tooling behavior. * Updated documentation to reflect the revised build command and clarify the local development workflow. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
This change is
Summary by CodeRabbit
Chores
debuggem to improve debugging capabilities during development and testing.Enhancements
wp-servercommand for better environment variable handling.shakapackerscript to optimize pack generation before compilation.shakapacker-dev-serverto recommend pack generation before running the development server.