-
-
Notifications
You must be signed in to change notification settings - Fork 638
Enhance documentation and integrate latest release updates (v16.0.1-rc.4) #1761
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
Changes from all commits
bf11184
77a4ef7
b381852
d9055bb
64d77b4
94a55cf
bde31fe
c58a8ee
2f44571
ab0b02a
4c1a3ab
e69300e
81a75dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "permissions": { | ||
| "allow": [ | ||
| "Bash(find:*)", | ||
| "Bash(git add:*)", | ||
| "Bash(git push:*)", | ||
| "Bash(rails new:*)", | ||
| "Bash(bundle:*)", | ||
| "Bash(rails:*)", | ||
| "Bash(git init:*)", | ||
| "Bash(git commit:*)", | ||
| "Bash(npm install:*)", | ||
| "Bash(bin/shakapacker:*)", | ||
| "Bash(git checkout:*)", | ||
| "Bash(git rebase:*)", | ||
| "WebFetch(domain:github.com)", | ||
| "Bash(yarn run lint)", | ||
| "Bash(yarn run prettier:*)", | ||
| "Bash(test:*)", | ||
| "Bash(rake lint)", | ||
| "Bash(yarn run:*)", | ||
| "WebFetch(domain:vite-ruby.netlify.app)", | ||
| "WebSearch", | ||
| "Bash(gem install:*)", | ||
| "Bash(gem search:*)", | ||
| "Bash(git reset:*)", | ||
| "Read(//Users/justin/shakacode/react-on-rails/**)", | ||
| "Bash(./bin/dev)", | ||
| "Bash(node:*)", | ||
| "Bash(git cherry-pick:*)" | ||
| ], | ||
| "deny": [], | ||
| "ask": [] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,231 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| # π€ AI Agent Instructions: React on Rails Setup | ||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π§© Analysis chainFix Prettier/markdownlint failures for this file. CI reports Prettier issues; run: π Script executed: #!/bin/bash
npx prettier --write AI_AGENT_INSTRUCTIONS.md
npx markdownlint-cli2 AI_AGENT_INSTRUCTIONS.mdLength of output: 1058 Fix markdownlint failures in AI_AGENT_INSTRUCTIONS.md (MD013, MD040) Prettier ran but markdownlint still reports 8 errors β wrap long lines to β€80 chars and add language specifiers to fenced code blocks.
Re-run verification after fixes: npx prettier --write AI_AGENT_INSTRUCTIONS.md && npx markdownlint-cli2 AI_AGENT_INSTRUCTIONS.mdπ§° Toolsπͺ GitHub Actions: Lint JS and Ruby[error] 1-1: Prettier formatting issues detected. Run 'prettier --write' to fix. π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| *Super concise, copy-paste instructions for AI agents to set up React on Rails in common scenarios.* | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## π **Before Starting: Check Current Versions** | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Get latest available versions (recommended approach) | ||||||||||||||||||||||||||||||||||||||||||||||||
| gem search react_on_rails --remote | ||||||||||||||||||||||||||||||||||||||||||||||||
| gem search shakapacker --remote | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Or use specific versions from these commands in your Gemfile: | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Latest stable versions as of Jan 2025: | ||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # react_on_rails ~> 15.0 | ||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wasn't 15.0 yanked? |
||||||||||||||||||||||||||||||||||||||||||||||||
| # shakapacker ~> 8.3 | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update pinned versions to v16 series. This PR targets 16.0.1-rc.2; docs still mention βLatest stable as of Jan 2025β and react_on_rails ~> 15.0. Recommend bumping to ~> 16.0 or remove the pinned example and say βbundle add react_on_rails --strictβ. -# Latest stable versions as of Jan 2025:
-# react_on_rails ~> 15.0
-# shakapacker ~> 8.3
+# Recommended constraint (Sep 2025):
+# react_on_rails ~> 16.0
+# shakapacker ~> 8.3π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **β οΈ Version Flexibility:** These instructions use `~> X.Y` which allows patch updates. Always check for latest versions before starting a new project. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We actually need them to be exactly the same. |
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## π¨ **CRITICAL: Installation Order Matters** | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **ALWAYS install Shakapacker FIRST, then React on Rails. Here's why:** | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| 1. **React on Rails generator requires `package.json`** to add JavaScript dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||
| 2. **Rails with `--skip-javascript` doesn't create `package.json`** | ||||||||||||||||||||||||||||||||||||||||||||||||
| 3. **Shakapacker creates `package.json`** and JavaScript tooling foundation | ||||||||||||||||||||||||||||||||||||||||||||||||
| 4. **Wrong order = "package.json not found" error** | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **β Correct Order:** | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
| Shakapacker β package.json created β React on Rails β success | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **β Wrong Order:** | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
| React on Rails β no package.json β ERROR: package.json not found | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## π Scenario 1: New Rails App with React on Rails | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Create new Rails app | ||||||||||||||||||||||||||||||||||||||||||||||||
| rails new myapp --skip-javascript --database=postgresql | ||||||||||||||||||||||||||||||||||||||||||||||||
| cd myapp | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # STEP 1: Add Shakapacker first (creates package.json) | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo 'gem "shakapacker", "~> 8.3"' >> Gemfile | ||||||||||||||||||||||||||||||||||||||||||||||||
| bundle install | ||||||||||||||||||||||||||||||||||||||||||||||||
| bundle exec rails shakapacker:install | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # STEP 2: Add React on Rails (requires package.json to exist) | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo 'gem "react_on_rails", "~> 15.0"' >> Gemfile | ||||||||||||||||||||||||||||||||||||||||||||||||
| bundle install | ||||||||||||||||||||||||||||||||||||||||||||||||
| rails generate react_on_rails:install | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Start development servers | ||||||||||||||||||||||||||||||||||||||||||||||||
| bin/dev | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+43
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Include npm/yarn install before starting dev servers. Generators add JS deps; without install, bin/dev often fails on a clean machine. rails generate react_on_rails:install
# Start development servers
-bin/dev
+npm install # or: yarn install
+bin/devπ Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **β Success Check:** Visit `http://localhost:3000/hello_world` β Should see "Hello World" from React | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **π Generated Files:** | ||||||||||||||||||||||||||||||||||||||||||||||||
| - `app/javascript/bundles/HelloWorld/components/HelloWorld.jsx` | ||||||||||||||||||||||||||||||||||||||||||||||||
| - `app/controllers/hello_world_controller.rb` | ||||||||||||||||||||||||||||||||||||||||||||||||
| - `app/views/hello_world/index.html.erb` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## π Scenario 2: Add React on Rails to Existing Rails App | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Navigate to existing Rails app root | ||||||||||||||||||||||||||||||||||||||||||||||||
| cd /path/to/existing/app | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # STEP 1: Add Shakapacker first (creates package.json if missing) | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo 'gem "shakapacker", "~> 8.3"' >> Gemfile | ||||||||||||||||||||||||||||||||||||||||||||||||
| bundle install | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Check if package.json exists, create if missing | ||||||||||||||||||||||||||||||||||||||||||||||||
| if [ ! -f "package.json" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||
| bundle exec rails shakapacker:install | ||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # STEP 2: Add React on Rails (requires package.json to exist) | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo 'gem "react_on_rails", "~> 15.0"' >> Gemfile | ||||||||||||||||||||||||||||||||||||||||||||||||
| bundle install | ||||||||||||||||||||||||||||||||||||||||||||||||
| rails generate react_on_rails:install --ignore-existing-files | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+86
to
+90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π‘ Verification agent π§© Analysis chainVerify generator flag support ( Iβm not sure this flag exists for Run a quick check or update to a supported flag, e.g., remove it if unnecessary: -rails generate react_on_rails:install --ignore-existing-files
+rails generate react_on_rails:installπ Web query: π‘ Result: Supported generator options (rails generate react_on_rails:install) in React on Rails 15.x:
Sources: React on Rails generator docs and package docs. [1] [2] References Citations:
Drop unsupported -rails generate react_on_rails:install --ignore-existing-files
+rails generate react_on_rails:installπ Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
| # Add React component to existing view | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Replace <view-name> with your actual view file | ||||||||||||||||||||||||||||||||||||||||||||||||
| cat >> app/views/<view-name>/<action>.html.erb << 'EOF' | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| <%= react_component("HelloWorld", props: { name: "World" }) %> | ||||||||||||||||||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Start development | ||||||||||||||||||||||||||||||||||||||||||||||||
| bin/dev | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **β οΈ Pre-flight Checks:** | ||||||||||||||||||||||||||||||||||||||||||||||||
| - Rails app has `bin/dev` or similar dev script | ||||||||||||||||||||||||||||||||||||||||||||||||
| - Shakapacker will create `package.json` if it doesn't exist | ||||||||||||||||||||||||||||||||||||||||||||||||
| - No existing React setup conflicts | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **β Success Check:** React component renders in your chosen view | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## β‘ Scenario 3: Convert Vite-Ruby to React on Rails | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Navigate to app root | ||||||||||||||||||||||||||||||||||||||||||||||||
| cd /path/to/vite/ruby/app | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Remove Vite-Ruby gems from Gemfile | ||||||||||||||||||||||||||||||||||||||||||||||||
| sed -i.bak '/gem.*vite_rails/d' Gemfile | ||||||||||||||||||||||||||||||||||||||||||||||||
| sed -i.bak '/gem.*vite_ruby/d' Gemfile | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Backup existing Vite config | ||||||||||||||||||||||||||||||||||||||||||||||||
| mv vite.config.* vite.config.backup 2>/dev/null || true | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Remove Vite-specific files | ||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf config/vite.json | ||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf bin/vite* | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # STEP 1: Add Shakapacker first (creates package.json) | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo 'gem "shakapacker", "~> 8.3"' >> Gemfile | ||||||||||||||||||||||||||||||||||||||||||||||||
| bundle install | ||||||||||||||||||||||||||||||||||||||||||||||||
| bundle exec rails shakapacker:install --force | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # STEP 2: Add React on Rails (requires package.json to exist) | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo 'gem "react_on_rails", "~> 15.0"' >> Gemfile | ||||||||||||||||||||||||||||||||||||||||||||||||
| bundle install | ||||||||||||||||||||||||||||||||||||||||||||||||
| rails generate react_on_rails:install --force | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Migrate existing React components | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Move components from app/frontend/entrypoints/ to app/javascript/bundles/ | ||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p app/javascript/bundles/Components | ||||||||||||||||||||||||||||||||||||||||||||||||
| find app/frontend -name "*.jsx" -o -name "*.tsx" | while read file; do | ||||||||||||||||||||||||||||||||||||||||||||||||
| basename=$(basename "$file") | ||||||||||||||||||||||||||||||||||||||||||||||||
| cp "$file" "app/javascript/bundles/Components/$basename" | ||||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Update component registrations in app/javascript/packs/hello-world-bundle.js | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "// Register your existing components here" | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "// import YourComponent from '../bundles/Components/YourComponent';" | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "// ReactOnRails.register({ YourComponent });" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Clean up old Vite files | ||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf app/frontend | ||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf public/vite* | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Update views to use React on Rails helpers | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Replace vite_javascript_tag with javascript_pack_tag | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Replace vite_stylesheet_tag with stylesheet_pack_tag | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Install dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||
| yarn install | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Start development | ||||||||||||||||||||||||||||||||||||||||||||||||
| bin/dev | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+111
to
+164
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Fix find(1) OR precedence and restrict to files; standardize package install. The find expression needs grouping; otherwise matches can be inconsistent. Also, prefer npm (or explicitly note yarn alternative) for consistency with the rest of the doc. -find app/frontend -name "*.jsx" -o -name "*.tsx" | while read file; do
+find app/frontend \( -name "*.jsx" -o -name "*.tsx" \) -type f | while read file; do
basename=$(basename "$file")
cp "$file" "app/javascript/bundles/Components/$basename"
done
@@
-# Install dependencies
-yarn install
+# Install dependencies
+npm install # or: yarn installπ€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **π§ Manual Steps Required:** | ||||||||||||||||||||||||||||||||||||||||||||||||
| 1. **Update views**: Replace `vite_javascript_tag` with `javascript_pack_tag "hello-world-bundle"` | ||||||||||||||||||||||||||||||||||||||||||||||||
| 2. **Register components**: Add your components to `app/javascript/packs/hello-world-bundle.js` | ||||||||||||||||||||||||||||||||||||||||||||||||
| 3. **Update imports**: Change relative paths if needed | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **β Success Check:** | ||||||||||||||||||||||||||||||||||||||||||||||||
| - `bin/dev` starts without Vite errors | ||||||||||||||||||||||||||||||||||||||||||||||||
| - React components render using `<%= react_component("YourComponent") %>` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## π οΈ Common Troubleshooting Commands | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Check current versions and compatibility | ||||||||||||||||||||||||||||||||||||||||||||||||
| bundle info react_on_rails shakapacker | ||||||||||||||||||||||||||||||||||||||||||||||||
| rails --version | ||||||||||||||||||||||||||||||||||||||||||||||||
| ruby --version | ||||||||||||||||||||||||||||||||||||||||||||||||
| node --version | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Check React on Rails installation | ||||||||||||||||||||||||||||||||||||||||||||||||
| rails runner "puts ReactOnRails::VERSION" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Verify Shakapacker setup | ||||||||||||||||||||||||||||||||||||||||||||||||
| bin/shakapacker --version | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Clear cache if components not updating | ||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf tmp/cache public/packs | ||||||||||||||||||||||||||||||||||||||||||||||||
| rails assets:clobber | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Check component registration | ||||||||||||||||||||||||||||||||||||||||||||||||
| rails runner "puts ReactOnRails.configuration.components_subdirectory" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Restart with clean build | ||||||||||||||||||||||||||||||||||||||||||||||||
| pkill -f "bin/shakapacker-dev-server" | ||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf public/packs-test | ||||||||||||||||||||||||||||||||||||||||||||||||
| bin/dev | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## π Quick Reference | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ### Essential Files Structure | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
| app/ | ||||||||||||||||||||||||||||||||||||||||||||||||
| βββ controllers/hello_world_controller.rb | ||||||||||||||||||||||||||||||||||||||||||||||||
| βββ views/hello_world/index.html.erb | ||||||||||||||||||||||||||||||||||||||||||||||||
| βββ javascript/ | ||||||||||||||||||||||||||||||||||||||||||||||||
| βββ bundles/HelloWorld/components/HelloWorld.jsx | ||||||||||||||||||||||||||||||||||||||||||||||||
| βββ packs/hello-world-bundle.js | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ### Key Commands | ||||||||||||||||||||||||||||||||||||||||||||||||
| - **Development**: `bin/dev` (starts Rails + Shakapacker) | ||||||||||||||||||||||||||||||||||||||||||||||||
| - **Generate**: `rails generate react_on_rails:install` | ||||||||||||||||||||||||||||||||||||||||||||||||
| - **Component**: `<%= react_component("ComponentName", props: {}) %>` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ### Version Requirements | ||||||||||||||||||||||||||||||||||||||||||||||||
| - Rails 7+ (Rails 8 supported), Ruby 3.0+ (Ruby 3.2+ for Rails 8), Node 20+ LTS, Yarn | ||||||||||||||||||||||||||||||||||||||||||||||||
| - react_on_rails ~> 15.0+, shakapacker ~> 8.3+ | ||||||||||||||||||||||||||||||||||||||||||||||||
| - **Note**: Use `bundle info react_on_rails` to check latest available version | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| *π‘ **Pro Tip for AI Agents**: Always run `bin/dev` to test setup, and check browser console for any JavaScript errors.* | ||||||||||||||||||||||||||||||||||||||||||||||||
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.
this file should not be in the repo. I'll remove in a separate commit.