Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e857e7a
Add react_on_rails:doctor generator for setup diagnostics
justin808 Sep 17, 2025
fb24efd
Fix RuboCop linting issues and improve code quality
justin808 Sep 17, 2025
8c2a0ed
Fix test failures and ensure CI compatibility
justin808 Sep 17, 2025
c6aef7b
Fix Prettier formatting for CHANGELOG and CLAUDE.md
justin808 Sep 17, 2025
33b7a4c
Refactor doctor from Rails generator to rake task and remove irreleva…
justin808 Sep 18, 2025
5f81305
Add version reporting to doctor for React, Shakapacker, and Webpack
justin808 Sep 18, 2025
c9e5146
Fix server bundle path detection to use Shakapacker configuration
justin808 Sep 18, 2025
9d53402
Use Shakapacker gem API for server bundle path detection
justin808 Sep 18, 2025
17db728
Improve doctor output with contextual and actionable recommendations
justin808 Sep 18, 2025
40d161e
Add temporary debug info to diagnose path duplication issue
justin808 Sep 18, 2025
df0ad01
Fix server bundle path duplication by handling nested absolute paths
justin808 Sep 18, 2025
cfd9ccf
WIP: Doctor enhancements for Procfile and bin/dev analysis
justin808 Sep 18, 2025
13aa713
Fix linting issues in doctor functionality
justin808 Sep 18, 2025
9335b23
Complete linting fixes for doctor functionality
justin808 Sep 18, 2025
131ddd9
Enhance React on Rails doctor with comprehensive diagnostics
justin808 Sep 18, 2025
87ff317
Replace shell-dependent backtick call with secure Open3 invocation
justin808 Sep 18, 2025
0b72fc2
Apply autofix formatting and resolve linting violations
justin808 Sep 18, 2025
bf68310
Implement comprehensive doctor improvements based on user feedback
justin808 Sep 19, 2025
b591a8e
Fix webpack inspection commands to use valid options
justin808 Sep 19, 2025
bb648dd
Improve bundle analysis instructions with complete workflow
justin808 Sep 19, 2025
56902b0
Enhance React on Rails doctor with comprehensive configuration analysis
justin808 Sep 19, 2025
1a0a0f2
Fix shell injection vulnerabilities and RuboCop violations
justin808 Sep 19, 2025
1926e65
Trigger CI to test security and linting fixes
justin808 Sep 20, 2025
85db2ab
Fix Prettier formatting in CLAUDE.md
justin808 Sep 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ Changes since the last non-beta release.
- **Cleaner generated code**: Streamlined templates following modern React and TypeScript best practices
- **Improved helper methods**: Added reusable `component_extension` helper for consistent file extension handling

#### Added

- **`react_on_rails:doctor` rake task**: New diagnostic command to validate React on Rails setup and identify configuration issues. Provides comprehensive checks for environment prerequisites, dependencies, Rails integration, and Webpack configuration. Use `rake react_on_rails:doctor` to diagnose your setup, with optional `VERBOSE=true` for detailed output.

### [16.0.0] - 2025-09-16

**React on Rails v16 is a major release that modernizes the library with ESM support, removes legacy Webpacker compatibility, and introduces significant performance improvements. This release builds on the foundation of v14 with enhanced RSC (React Server Components) support and streamlined configuration.**
Expand Down
16 changes: 14 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## ⚠️ CRITICAL REQUIREMENTS

**BEFORE EVERY COMMIT/PUSH:**

1. **ALWAYS run `bundle exec rubocop` and fix ALL violations**
2. **ALWAYS ensure files end with a newline character**
3. **NEVER push without running full lint check first**

These requirements are non-negotiable. CI will fail if not followed.

## Development Commands

### Essential Commands
Expand All @@ -11,15 +21,17 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
- Ruby tests: `rake run_rspec`
- JavaScript tests: `yarn run test` or `rake js_tests`
- All tests: `rake` (default task runs lint and all tests except examples)
- **Linting**:
- **Linting** (MANDATORY BEFORE EVERY COMMIT):
- **REQUIRED**: `bundle exec rubocop` - Must pass with zero offenses
- All linters: `rake lint` (runs ESLint and RuboCop)
- ESLint only: `yarn run lint` or `rake lint:eslint`
- RuboCop only: `rake lint:rubocop`
- **Code Formatting**:
- Format code with Prettier: `yarn start format`
- Format code with Prettier: `rake autofix`
- Check formatting without fixing: `yarn start format.listDifferent`
- **Build**: `yarn run build` (compiles TypeScript to JavaScript in node_package/lib)
- **Type checking**: `yarn run type-check`
- **⚠️ MANDATORY BEFORE GIT PUSH**: `bundle exec rubocop` and fix ALL violations + ensure trailing newlines

### Development Setup Commands

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ rails generate react_on_rails:install
- `shakapacker.yml` settings
- other configuration files

### Troubleshooting Setup Issues

If you encounter issues during installation or after upgrading, use the doctor command to diagnose your setup:

```bash
rake react_on_rails:doctor
```

The doctor command checks your environment, dependencies, and configuration files to identify potential issues. Use `VERBOSE=true rake react_on_rails:doctor` for detailed output.

For detailed upgrade instructions, see [upgrade guide documentation](docs/guides/upgrading-react-on-rails.md).

## React on Rails Pro
Expand Down
65 changes: 65 additions & 0 deletions lib/generators/react_on_rails/USAGE
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doctor should be

rake react_on_rails:doctor

and NOT a generator

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Description:
The `react_on_rails:doctor` generator diagnoses your React on Rails setup
and identifies potential configuration issues. It performs comprehensive
checks on your environment, dependencies, and configuration files.
Comment on lines +2 to +4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Update docs: this is a Rake task, not a generator

Replace β€œgenerator” wording and all examples with the rake task usage.

Apply this diff:

-    The `react_on_rails:doctor` generator diagnoses your React on Rails setup
+    The `react_on_rails:doctor` Rake task diagnoses your React on Rails setup
@@
-    # Basic diagnosis
-    rails generate react_on_rails:doctor
+    # Basic diagnosis
+    rake react_on_rails:doctor
@@
-    # Verbose output showing all checks
-    rails generate react_on_rails:doctor --verbose
+    # Verbose output showing all checks
+    VERBOSE=true rake react_on_rails:doctor
@@
-    # Show help
-    rails generate react_on_rails:doctor --help
+    # Show help
+    rake -T react_on_rails
+    # Or detailed task description (if provided)
+    rake -D react_on_rails:doctor

Also applies to: 12-21

πŸ€– Prompt for AI Agents
In lib/generators/react_on_rails/USAGE around lines 2-4 (and also update lines
12-21), the document incorrectly calls react_on_rails:doctor a "generator" and
shows generator usage examples; update the wording to state it is a Rake task
and replace all instances of "generator" with "Rake task" (or "rake task"),
change example commands to the rake invocation (e.g., rake react_on_rails:doctor
or bundle exec rake react_on_rails:doctor), and adjust any explanatory text to
reference running the rake task rather than generator usage.


This command is especially useful for:
β€’ Troubleshooting setup issues
β€’ Verifying installation after running react_on_rails:install
β€’ Ensuring compatibility after upgrades
β€’ Getting help with configuration problems

Example:
# Basic diagnosis
rails generate react_on_rails:doctor

# Verbose output showing all checks
rails generate react_on_rails:doctor --verbose

# Show help
rails generate react_on_rails:doctor --help

Checks performed:
Environment Prerequisites:
β€’ Node.js installation and version compatibility
β€’ JavaScript package manager availability (npm, yarn, pnpm, bun)
β€’ Git working directory status

React on Rails Packages:
β€’ React on Rails gem installation
β€’ react-on-rails NPM package installation
β€’ Version synchronization between gem and NPM package
β€’ Shakapacker configuration and installation

Dependencies:
β€’ React and React DOM installation
β€’ Babel preset configuration
β€’ Required development dependencies

Rails Integration:
β€’ React on Rails initializer configuration
β€’ Route and controller setup (Hello World example)
β€’ View helper integration

Webpack Configuration:
β€’ Webpack config file existence and structure
β€’ React on Rails compatibility checks
β€’ Environment-specific configuration validation

Development Environment:
β€’ JavaScript bundle files
β€’ Procfile.dev for development workflow
β€’ .gitignore configuration for generated files

Options:
--verbose, -v: Show detailed output for all checks, including successful ones
--fix, -f: Attempt to fix simple issues automatically (planned feature)

Exit codes:
0: All checks passed or only warnings found
1: Critical errors found that prevent React on Rails from working

For more help:
β€’ Documentation: https://github.com/shakacode/react_on_rails
β€’ Issues: https://github.com/shakacode/react_on_rails/issues
β€’ Discord: https://discord.gg/reactrails
Loading
Loading