Add extensible bin/dev precompile pattern (#2347)#2349
Conversation
WalkthroughAdds documentation and a commented scaffold supporting an extensible bin/dev precompile pattern (examples use ReactOnRails::Locales.compile), updates i18n and process-manager docs, updates the generator Changes
Sequence Diagram(s)(omitted — changes are documentation and commented scaffolding; no new runtime control flow to visualize) Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile OverviewGreptile SummaryIntroduced extensible Key Changes
Benefits of This Pattern
Documentation QualityThe documentation is thorough with clear examples, comparison tables, troubleshooting sections, and FAQ. One minor style improvement suggested for YAML formatting clarity. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant bindev as bin/dev
participant Rails as Rails Environment
participant Locales as ReactOnRails::Locales
participant PM as Process Manager
participant Webpack
User->>bindev: ./bin/dev
alt Extensible Pattern (Uncommented)
bindev->>bindev: Check args (not kill/help)
bindev->>bindev: run_precompile_tasks()
bindev->>Rails: require "../config/environment"
Rails-->>bindev: Environment loaded
opt Custom Build Steps
bindev->>bindev: system("yarn res:build")
end
opt Locale Generation
bindev->>Locales: ReactOnRails::Locales.compile
Locales->>Locales: Check if files up-to-date
alt Files stale or missing
Locales->>Locales: Generate translations.json/js
Locales->>Locales: Generate default.json/js
Locales-->>bindev: Success
else Files up-to-date
Locales-->>bindev: Skipped (up-to-date)
end
end
bindev->>bindev: puts "✅"
end
bindev->>PM: ReactOnRails::Dev::ServerManager.run_from_command_line
PM->>PM: Read Procfile.dev
par Parallel Processes
PM->>Rails: bundle exec rails s
PM->>Webpack: bin/shakapacker-dev-server
PM->>Webpack: bin/shakapacker --watch
end
Note over PM,Webpack: No precompile_hook<br/>called by webpack<br/>(already done)
|
Code Review: Extensible bin/dev Precompile PatternThis PR introduces a well-documented alternative approach for handling precompile tasks. Overall the implementation is solid, but I have some suggestions for improvement. ✅ Strengths
🔍 Potential Issues & Suggestions1. Error Handling in Example CodeIn the # Example: Generate locales using direct Ruby API (faster than rake task)
# This avoids shell spawning and version manager PATH issues
print " Locale generation... "
ReactOnRails::Locales.compile if ReactOnRails.configuration.i18n_dir.present?
puts "✅"Issue: If Suggestion: Add error handling in examples: print " Locale generation... "
begin
ReactOnRails::Locales.compile if ReactOnRails.configuration.i18n_dir.present?
puts "✅"
rescue => e
puts "❌"
warn "Failed to compile locales: #{e.message}"
exit(1)
endOr at minimum, update the documentation to show best practices for error handling. 2. Inconsistency in
|
Code Review - PR #2349: Add extensible bin/dev precompile pattern✅ Overall AssessmentThis is a well-crafted PR that adds valuable documentation and examples for handling complex precompile scenarios. The code quality is excellent, and the approach is sound. I have a few suggestions for minor improvements. 🎯 Strengths
📋 Minor Suggestions1. Consistency in wording (Documentation)In # Project-specific: Build ReScript filesBut in # Example: Build ReScript filesSuggestion: Use consistent language. I'd recommend "Example:" throughout since this is a template users will customize, not a project-specific implementation. 2. Error handling in bin/dev exampleIn print " ReScript build... "
system("yarn res:build") or exit(1)
puts "✅"Concern: If Suggestion: Add clearer error handling: print " ReScript build... "
unless system("yarn res:build")
puts "❌"
exit(1)
end
puts "✅"Or at minimum, add a comment explaining the pattern: # Uses 'or exit(1)' to halt immediately on failure
system("yarn res:build") or exit(1)3. ReactOnRails::Locales.compile return valueLooking at In the documentation ( print " Locale generation... "
ReactOnRails::Locales.compile if ReactOnRails.configuration.i18n_dir.present?
puts "✅"Question: Should users check if Suggestion: Either:
From reading # ReactOnRails::Locales.compile handles all edge cases gracefully:
# - Prints warnings if no locale files found
# - Skips if files are up-to-date (unless force: true)
# - Safe to call even if i18n is not configured
ReactOnRails::Locales.compile if ReactOnRails.configuration.i18n_dir.present?4. Link to actual documentation URLIn # See documentation: https://www.shakacode.com/react-on-rails/docs/building-features/extensible-precompile-patternVerification needed: Does this URL exist/will it exist when docs are deployed? Suggestion: Verify the URL path matches your docs deployment structure. Based on the file location ( 5. Test coverage considerationThe PR adds documentation for using Question: Are there existing tests that verify:
Looking at If not, consider adding a simple integration test that:
🔒 Security Considerations✅ No security concerns. The changes are purely documentation and commented template code. ⚡ Performance Considerations✅ Performance improvement: The documentation correctly notes that using From 🧪 Test CoverageAs noted in the PR description, the test plan focuses on documentation rendering and link validation:
Additional testing suggestion: Manually verify the # Generate a new Rails app with React on Rails
rails new test_app
cd test_app
rails generate react_on_rails:install
# Verify bin/dev contains the commented pattern
grep -A 20 'EXTENSIBLE PRECOMPILE PATTERN' bin/dev
# Uncomment the pattern and verify it works
# (This would catch syntax errors or API issues)📝 Suggestions Summary
✅ RecommendationApprove with minor suggestions. The PR is ready to merge after addressing the documentation clarity points (none are blocking issues). Great work providing this alternative pattern for complex build scenarios! This will be very helpful for projects with custom requirements. 🤖 Review conducted using repository's CLAUDE.md guidelines |
Pull Request Review: Extensible bin/dev Precompile PatternI've reviewed PR #2349 and here's my comprehensive feedback: ✅ Code Quality & Best PracticesStrengths:
Documentation Quality:
🔍 Potential Issues & Concerns1. API Documentation Clarity (Minor)
2. Configuration Consistency (Minor) # Optional: set to false to disable Shakapacker's own precompile behavior
# shakapacker_precompile: false
3. Error Handling in bin/dev Template (Minor) ReactOnRails::Locales.compile if ReactOnRails.configuration.i18n_dir.present?
puts "✅"
4. YAML Configuration Example Placement
🔒 Security ConcernsNo significant security issues identified. The changes are documentation-heavy and the code additions are:
⚡ Performance ConsiderationsPositive impacts:
Potential concern:
🧪 Test CoverageCurrent state:
Observations:
However, this may be overkill given the opt-in nature and documentation focus of this PR. 📋 Documentation CompletenessExcellent documentation coverage:
Test plan in PR description:
🎯 Additional Recommendations
📊 Overall AssessmentThis is a high-quality PR that:
The issues identified are minor and mostly about documentation polish rather than code correctness or safety concerns. Recommendation: Approve with minor suggestions ✅ The PR is ready to merge as-is, though the minor suggestions above would further improve it. Review completed using repository guidelines from CLAUDE.md and AGENTS.md |
- Add YARD-style documentation to ReactOnRails::Locales.compile to formalize its public API status - Clarify shakapacker.yml config with Before/After examples showing the migration from precompile_hook to extensible bin/dev approach - Remove misleading shakapacker_precompile: false advice from docs and bin/dev template (that controls production asset compilation, not the precompile hook) - Add error handling note: exceptions from Locales.compile bubble up and stop the dev server, surfacing config issues early - Add FAQ section: "When should I NOT use this pattern?" - Add Compatibility section noting React on Rails 16.2+ requirement - Add CHANGELOG entry under [Unreleased] for PR #2349 Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@docs/building-features/extensible-precompile-pattern.md`:
- Around line 170-179: Update the "When precompile runs" row to explicitly state
the trade-off: explain that the extensible/bin/dev approach runs precompile once
at dev server startup (e.g., tasks added to run_precompile_tasks and
ReactOnRails::Locales.compile) so changes to locale YAML or other precompile
inputs while the server is running will require manually re-running the
precompile tasks or restarting bin/dev, whereas the default precompile_hook
re-invokes before each webpack compile and therefore picks up such changes
automatically.
🧹 Nitpick comments (2)
react_on_rails/lib/generators/react_on_rails/templates/base/base/bin/dev (1)
77-81: Guard condition doesn't cover all non-server commands.The ARGV check skips precompile for
kill,-h,--help, andhelp. IfServerManager.run_from_command_linesupports other non-server subcommands in the future, this guard will need updating. Consider inverting the logic to an allowlist of commands that should run precompile, or extracting this check into a helper.docs/building-features/extensible-precompile-pattern.md (1)
40-44: Use package-manager-agnostic examples.The examples hardcode
yarn(lines 41, 112, 114, 135, 136). End-user documentation should include npm, yarn, and pnpm alternatives or use a generic placeholder. Based on learnings: "In all end-user documentation under docs/, ensure package-manager-agnostic installation instructions include npm, yarn, and pnpm."Example adjustment for line 41
- unless system("yarn res:build") + # Use the package manager for your project (npm, yarn, or pnpm) + unless system("npx res:build") # or: yarn res:build / pnpm res:build
Addresses #2347: Provides an alternative approach to handling precompile tasks that offers more flexibility than the default precompile_hook mechanism. Key changes: - Update bin/dev template with commented extensible precompile pattern that users can uncomment and customize for their needs - Document ReactOnRails::Locales.compile as a public API in i18n docs for faster locale generation without shell overhead - Create new extensible-precompile-pattern.md guide covering: - When to use this pattern vs precompile_hook - Implementation steps with code examples - Benefits comparison table - Troubleshooting common issues - Update process-managers.md to reference the new pattern This pattern is especially useful for projects with: - Multiple precompile tasks (ReScript, TypeScript, custom locales) - Version manager issues (mise, asdf, rbenv) - Need for cleaner Procfiles without embedded precompile logic Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Use consistent "Example:" wording (was "Project-specific:" in docs) - Improve error handling pattern: use unless/end block with ❌ indicator instead of `system(...) or exit(1)` for clearer failure reporting - Add comment explaining ReactOnRails::Locales.compile graceful behavior Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Add YARD-style documentation to ReactOnRails::Locales.compile to formalize its public API status - Clarify shakapacker.yml config with Before/After examples showing the migration from precompile_hook to extensible bin/dev approach - Remove misleading shakapacker_precompile: false advice from docs and bin/dev template (that controls production asset compilation, not the precompile hook) - Add error handling note: exceptions from Locales.compile bubble up and stop the dev server, surfacing config issues early - Add FAQ section: "When should I NOT use this pattern?" - Add Compatibility section noting React on Rails 16.2+ requirement - Add CHANGELOG entry under [Unreleased] for PR #2349 Co-Authored-By: Claude Opus 4.6 <[email protected]>
f24328e to
4c5d6bb
Compare
Code Review - PR #2349: Extensible bin/dev Precompile PatternSummaryThis PR introduces an alternative approach for handling precompile tasks directly in ✅ StrengthsDocumentation Quality
Code Quality
Design Decisions
💡 Suggestions for Improvement1. Error Handling in Documentation ExampleLocation: The example shows error handling for the ReScript build but not for locale compilation. Consider adding a note about when # Current example silently continues if locale compilation fails
print " Locale generation... "
ReactOnRails::Locales.compile if ReactOnRails.configuration.i18n_dir.present?
puts "✅"Suggestion: Add a comment explaining that exceptions will bubble up (as mentioned later in the doc), or show a consistent error handling pattern: # Locale generation via direct Ruby API (faster, no shell issues)
# Note: Exceptions (missing directories, etc.) will halt execution - this is intentional
# to surface configuration issues early during development startup
print " Locale generation... "
ReactOnRails::Locales.compile if ReactOnRails.configuration.i18n_dir.present?
puts "✅"2. Clarity on When Precompile Tasks RunLocation: The benefits table mentions "Once at dev server startup" but this could be clearer. Users might wonder: what happens on code changes? What about when webpack rebuilds? Suggestion: Add a subsection explaining the execution timing: ## Execution Timing
With this pattern, precompile tasks run:
- ✅ Once when you start `bin/dev`
- ✅ On manual restarts of `bin/dev`
- ❌ NOT on file changes during development
- ❌ NOT on webpack hot reload
For production builds, ensure tasks are included in `build_production_command`.3. Testing ConsiderationsObservation: The PR description mentions documentation testing, but the pattern itself involves executable code in Questions:
Suggestion: Add a "Testing" subsection: ## Testing Your Configuration
Before relying on this pattern in production:
1. **Verify syntax**: Ensure your `bin/dev` has valid Ruby syntax
```bash
ruby -c bin/dev
This looks like it should be valid YAML but the # precompile_hook not configured - handled by bin/dev instead5. Security: Command Injection in ExamplesLocation: Multiple places showing While the examples are safe, users might extend this pattern with user input. Consider adding a security note: ### Security Note
When adding custom build commands, avoid using user input or environment variables directly in `system()` calls. Use array form for complex commands:
```ruby
# Safe
system(["yarn", "res:build"])
# Potentially unsafe if MY_VAR comes from untrusted source
# system("yarn res:build --flag=\#{ENV['MY_VAR']}")2. CHANGELOG FormatLocation: The changelog entry looks good overall. Verify it matches the format specified in
🎯 Test CoverageBased on the PR description, the test plan focuses on documentation:
Recommendation: Also verify:
📊 Performance ConsiderationsThe PR claims performance benefits from avoiding shell spawning. This is accurate:
No performance concerns with this approach. 🔒 Security Assessment
🧪 Final RecommendationStatus: ✅ Approve with minor suggestions This is a high-quality PR that:
The suggestions above are minor improvements that could be addressed in this PR or follow-ups. None are blocking issues. Before Merge Checklist
Great work on this feature! The dual-approach strategy (keeping the existing |
Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
@greptile, review this PR. |
|
Claude finished @justin808's task in 2m 11s —— View job Code Review: Add extensible bin/dev precompile patternSummaryThis PR introduces a well-documented alternative approach for handling precompile tasks directly in ✅ Strengths1. Excellent Documentation Quality
2. Non-Breaking, Opt-In Design
3. Solves Real Problems
4. Well-Documented API
5. Good Test Coverage
🔍 Issues & Suggestions1. Precompile Timing Trade-off Needs Clarification
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@docs/building-features/extensible-precompile-pattern.md`:
- Line 233: Update the version statement to avoid claiming the feature is
already released: change "requires React on Rails 16.2+" to language that it
will require the forthcoming React on Rails release (post-16.3.0) or say "will
require the next React on Rails release" (so readers know it's unreleased). Also
clarify the API sentence to state that ReactOnRails::Locales.compile is an
existing API (available since i18n support was introduced) and that the
extensible precompile pattern uses that existing method (the same method used by
the react_on_rails:locale rake task).
🧹 Nitpick comments (1)
docs/building-features/extensible-precompile-pattern.md (1)
39-137: Add npm/yarn/pnpm alternatives for end-user commands.Multiple examples use
yarnonly (e.g.,yarn res:build, Procfile entries). Please include npm and pnpm equivalents so the docs are package-manager-agnostic.
Based on learnings: “In all end-user documentation under docs/, ensure package-manager-agnostic installation instructions include npm, yarn, and pnpm.”
|
|
||
| ## Compatibility | ||
|
|
||
| This pattern requires **React on Rails 16.2+** and works with any version of Shakapacker. The `ReactOnRails::Locales.compile` API has been available since React on Rails introduced i18n support and is the same method used internally by the `react_on_rails:locale` rake task. |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Find the Locales class and compile method
fd -t f "locales" --exec rg -l "Locales" {} \; | head -20Repository: shakacode/react_on_rails
Length of output: 227
🏁 Script executed:
# Search for Locales.compile definition
rg "class Locales|def compile" -t rb | head -20Repository: shakacode/react_on_rails
Length of output: 94
🏁 Script executed:
# Look for CHANGELOG or version information
fd -t f "(CHANGELOG|HISTORY|RELEASE)" -i | head -10Repository: shakacode/react_on_rails
Length of output: 270
🏁 Script executed:
# Check for version constant in the codebase
rg "VERSION\s*=" -t rb | grep -i react | head -10Repository: shakacode/react_on_rails
Length of output: 94
🏁 Script executed:
# Find Locales class definition
rg "class Locales" --type-list | head -5Repository: shakacode/react_on_rails
Length of output: 457
🏁 Script executed:
# Direct search for Locales class
rg "class Locales"Repository: shakacode/react_on_rails
Length of output: 50
🏁 Script executed:
# Check CHANGELOG for mentions of Locales or version 16.2
head -200 CHANGELOG.md | catRepository: shakacode/react_on_rails
Length of output: 19860
🏁 Script executed:
# Look for Locales.compile in implementation files
fd "locales" -t f | xargs rg "def compile"Repository: shakacode/react_on_rails
Length of output: 52
🏁 Script executed:
# Read the locales spec to understand when compile was introduced
cat -n react_on_rails/spec/react_on_rails/locales_spec.rb | head -100Repository: shakacode/react_on_rails
Length of output: 1949
🏁 Script executed:
# Check the documentation file itself to see context
head -250 docs/building-features/extensible-precompile-pattern.md | tail -50Repository: shakacode/react_on_rails
Length of output: 2025
🏁 Script executed:
# Search for when Locales class was first mentioned in changelog
grep -n "Locales" CHANGELOG.md | head -20Repository: shakacode/react_on_rails
Length of output: 673
🏁 Script executed:
# Find the Locales class definition file
fd "locales" -type f -path "*/lib/*" | head -20Repository: shakacode/react_on_rails
Length of output: 238
🏁 Script executed:
# Check git history or check the implementation file directly
fd -type f -name "*.rb" | xargs grep -l "class Locales" | grep -v specRepository: shakacode/react_on_rails
Length of output: 238
🏁 Script executed:
# Look at the actual Locales implementation
find react_on_rails/lib -name "*.rb" | xargs grep -l "class Locales"Repository: shakacode/react_on_rails
Length of output: 52
🏁 Script executed:
# Find Locales class definition
find react_on_rails/lib -name "*.rb" -exec grep -l "class Locales" {} \;Repository: shakacode/react_on_rails
Length of output: 50
🏁 Script executed:
# Look for Locales file directly
find react_on_rails/lib -name "*locales*"Repository: shakacode/react_on_rails
Length of output: 109
🏁 Script executed:
# Check when i18n support was introduced in the changelog
grep -B5 -A5 "i18n" CHANGELOG.md | head -50Repository: shakacode/react_on_rails
Length of output: 4052
🏁 Script executed:
# Look at the Locales class implementation
cat react_on_rails/lib/react_on_rails/locales.rbRepository: shakacode/react_on_rails
Length of output: 144
🏁 Script executed:
# Check the Locales directory structure
ls -la react_on_rails/lib/react_on_rails/locales/Repository: shakacode/react_on_rails
Length of output: 354
🏁 Script executed:
# Look at the base.rb file which likely contains the compile method
cat react_on_rails/lib/react_on_rails/locales/base.rbRepository: shakacode/react_on_rails
Length of output: 6303
🏁 Script executed:
# Check if there's an index or main file
ls -la react_on_rails/lib/react_on_rails/ | grep localesRepository: shakacode/react_on_rails
Length of output: 125
🏁 Script executed:
# Look for where Locales module/class is defined
rg "module Locales|class Locales" react_on_rails/lib/Repository: shakacode/react_on_rails
Length of output: 272
🏁 Script executed:
# Check when the extensible bin/dev pattern feature was added to codebase
git log --oneline --grep="2349" | head -5Repository: shakacode/react_on_rails
Length of output: 50
🏁 Script executed:
# Check if there are any version constraints in the Locales implementation
rg "VERSION|16\." react_on_rails/lib/react_on_rails/locales/Repository: shakacode/react_on_rails
Length of output: 50
🏁 Script executed:
# Look at the full documentation context around the claim
sed -n '220,250p' docs/building-features/extensible-precompile-pattern.mdRepository: shakacode/react_on_rails
Length of output: 1062
Update the React on Rails version requirement.
The statement "requires React on Rails 16.2+" is inaccurate. According to the CHANGELOG, the extensible bin/dev precompile pattern is a new feature currently listed under [Unreleased] and has not yet been published in any released version (the latest release is 16.3.0 from 2026-02-05). The version requirement should reflect that this pattern will be available in the next upcoming release, or be stated as "will require" the forthcoming version. Clarify whether the ReactOnRails::Locales.compile API reference is about the existing API (which has been available since i18n support was introduced) or specifically about the new extensible precompile pattern usage context.
🤖 Prompt for AI Agents
In `@docs/building-features/extensible-precompile-pattern.md` at line 233, Update
the version statement to avoid claiming the feature is already released: change
"requires React on Rails 16.2+" to language that it will require the forthcoming
React on Rails release (post-16.3.0) or say "will require the next React on
Rails release" (so readers know it's unreleased). Also clarify the API sentence
to state that ReactOnRails::Locales.compile is an existing API (available since
i18n support was introduced) and that the extensible precompile pattern uses
that existing method (the same method used by the react_on_rails:locale rake
task).
PR Review: Extensible bin/dev Precompile Pattern (#2349)Overall AssessmentThis PR provides a well-documented alternative approach to handling precompile tasks. The implementation is solid, documentation is comprehensive, and the pattern addresses real pain points with version managers and complex build setups. Approved with minor suggestions below. Code Quality & Best Practices ✅Strengths:
Suggestions:
Potential Bugs/Issues 🔍None identified. The implementation is defensive:
Performance Considerations ⚡Positive impacts:
Trade-off clearly documented:
Security Concerns 🔒No security issues identified.
Test Coverage 📋Current state: Test coverage assessment:
Recommendation:
Documentation Quality 📚Excellent overall. The new guide is well-structured with clear overview, step-by-step implementation, benefits comparison, troubleshooting section, and FAQ. Minor suggestions:
Code Style ComplianceChecked against AGENTS.md requirements:
Architecture & Design ⚙️Well thought out:
The pattern introduces two ways to accomplish the same thing, which is appropriate here because different approaches suit different project complexities. Recommendations SummaryMust fix: None Should consider:
Nice to have:
ConclusionThis is a high-quality PR that:
The code is production-ready. Great work! 🎉 |
| **Before (default precompile_hook approach):** | ||
|
|
||
| ```yaml | ||
| default: &default # ... other settings ... |
There was a problem hiding this comment.
inline comment # ... other settings ... should be on a separate line for clearer YAML formatting
| default: &default # ... other settings ... | |
| default: &default | |
| # ... other settings ... |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Review comment from Claude Code - detailed analysis follows in next comment |
Code Review: Add extensible bin/dev precompile patternSummaryThis PR introduces a well-designed alternative pattern for handling precompile tasks in React on Rails projects. The implementation is solid, and the documentation is thorough. ✅ Strengths1. Excellent Documentation Structure
2. Backward Compatibility
3. API Design
4. Code Quality
|
🔍 Areas for Improvement1. Error Handling in bin/dev Template (Minor)Location: react_on_rails/lib/generators/react_on_rails/templates/base/base/bin/dev:42-50 If ReactOnRails::Locales.compile raises an exception (e.g., file permission errors, malformed YAML), the success indicator will never print, but the error message could be confusing. The ReScript example properly handles this with unless system(...) exit(1) end. Suggestion: Consider wrapping in error handling or document that exceptions are intentionally allowed to bubble up (which is mentioned later in comments but not clearly in the example). 2. Documentation: Production Build Clarity (Minor)Location: docs/building-features/extensible-precompile-pattern.md:126-137 Add a note about locale generation in production builds. If someone uses this pattern and removes precompile_hook, they need to ensure locale generation happens in production deployments. 3. i18n.md Documentation Flow (Minor)Location: docs/building-features/i18n.md:22-62 The section now presents "Option A" (Direct Ruby API) before "Option B" (Rake task), and then has a "Recommended" subsection about precompile_hook. This creates some confusion about which approach is actually recommended. Suggestion: Restructure to have three distinct approaches with clearer guidance on when to use each. 4. Minor Consistency Issues
|
🔒 Security AssessmentNo security concerns identified.
⚡ Performance ConsiderationsPositive performance impact:
No performance concerns identified. 🧪 Test CoverageThis PR adds documentation and template changes but does not include tests for the new ReactOnRails::Locales.compile public API documentation. Recommendation: Verify that existing test coverage for ReactOnRails::Locales.compile includes:
|
🎯 Final RecommendationAPPROVED with minor suggestions. This is a well-thought-out addition that solves real problems (version manager compatibility, complex build pipelines) while maintaining backward compatibility. The documentation is thorough and the code quality is high. Before Merging:
None of these are blocking issues - they are refinements that would make an already-good PR even better. Great work! 🚀 Test Plan VerificationAdditional suggested testing:
Positive Patterns Worth Highlighting:
|
## Summary Addresses #2347: Provides an alternative approach to handling precompile tasks that offers more flexibility than the default `precompile_hook` mechanism. - **Update bin/dev template** with commented extensible precompile pattern that users can uncomment and customize - **Document `ReactOnRails::Locales.compile`** as a public API in i18n docs for faster locale generation without shell overhead - **Create new guide** `docs/building-features/extensible-precompile-pattern.md` covering the full pattern - **Update process-managers.md** to reference the new pattern ## Benefits This pattern is especially useful for projects with: - Multiple precompile tasks (ReScript, TypeScript, custom locales) - Version manager issues (mise, asdf, rbenv) with rake tasks - Need for cleaner Procfiles without embedded precompile logic ## Files Changed | File | Changes | |------|---------| | `bin/dev` template | Added commented extensible precompile pattern | | `docs/building-features/i18n.md` | Documented `ReactOnRails::Locales.compile` API | | `docs/building-features/process-managers.md` | Added reference to new pattern | | `docs/building-features/extensible-precompile-pattern.md` | **New** - Complete guide | ## Test plan - [ ] Documentation renders correctly on the docs site - [ ] Code examples in documentation are syntactically correct - [ ] Links between documentation pages work 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added a comprehensive guide for an extensible precompile pattern: overview, use cases, implementation steps, configuration, execution timing, troubleshooting, FAQ, and related links. * Expanded i18n docs to offer two locale-generation options (direct API or task), with idempotency and force-regeneration guidance. * Noted the alternative workflow in process-manager guidance and changelog; added explanatory dev-script comments and clarified API usage examples. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
Summary
Addresses #2347: Provides an alternative approach to handling precompile tasks that offers more flexibility than the default
precompile_hookmechanism.ReactOnRails::Locales.compileas a public API in i18n docs for faster locale generation without shell overheaddocs/building-features/extensible-precompile-pattern.mdcovering the full patternBenefits
This pattern is especially useful for projects with:
Files Changed
bin/devtemplatedocs/building-features/i18n.mdReactOnRails::Locales.compileAPIdocs/building-features/process-managers.mddocs/building-features/extensible-precompile-pattern.mdTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit