react_on_rails 15.0.0.rc.2 → 16.0.1.rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +103 -34
  3. data/CLAUDE.md +102 -0
  4. data/CODING_AGENTS.md +312 -0
  5. data/CONTRIBUTING.md +378 -3
  6. data/Gemfile.lock +2 -1
  7. data/LICENSE.md +30 -4
  8. data/LICENSES/README.md +14 -0
  9. data/REACT-ON-RAILS-PRO-LICENSE.md +129 -0
  10. data/README.md +70 -20
  11. data/TODO.md +135 -0
  12. data/eslint.config.ts +5 -0
  13. data/knip.ts +20 -9
  14. data/lib/generators/USAGE +4 -5
  15. data/lib/generators/react_on_rails/USAGE +65 -0
  16. data/lib/generators/react_on_rails/base_generator.rb +263 -57
  17. data/lib/generators/react_on_rails/dev_tests_generator.rb +1 -0
  18. data/lib/generators/react_on_rails/generator_helper.rb +35 -1
  19. data/lib/generators/react_on_rails/generator_messages.rb +138 -17
  20. data/lib/generators/react_on_rails/install_generator.rb +336 -26
  21. data/lib/generators/react_on_rails/react_no_redux_generator.rb +19 -6
  22. data/lib/generators/react_on_rails/react_with_redux_generator.rb +111 -18
  23. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev +5 -0
  24. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-prod-assets +8 -0
  25. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-static-assets +2 -0
  26. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +0 -5
  27. data/lib/generators/react_on_rails/templates/base/base/app/javascript/packs/server-bundle.js +1 -8
  28. data/lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx +21 -0
  29. data/lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.tsx +25 -0
  30. data/lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.module.css +4 -0
  31. data/lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.server.jsx +5 -0
  32. data/lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.server.tsx +5 -0
  33. data/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt +1 -1
  34. data/lib/generators/react_on_rails/templates/base/base/app/views/layouts/hello_world.html.erb +4 -2
  35. data/lib/generators/react_on_rails/templates/base/base/babel.config.js.tt +5 -2
  36. data/lib/generators/react_on_rails/templates/base/base/bin/dev +34 -0
  37. data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt +3 -3
  38. data/lib/generators/react_on_rails/templates/base/base/config/shakapacker.yml +76 -7
  39. data/lib/generators/react_on_rails/templates/base/base/config/webpack/commonWebpackConfig.js.tt +1 -1
  40. data/lib/generators/react_on_rails/templates/base/base/config/webpack/development.js.tt +8 -8
  41. data/lib/generators/react_on_rails/templates/base/base/config/webpack/production.js.tt +2 -2
  42. data/lib/generators/react_on_rails/templates/base/base/config/webpack/test.js.tt +2 -2
  43. data/lib/generators/react_on_rails/templates/dev_tests/spec/system/hello_world_spec.rb +0 -2
  44. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/actions/helloWorldActionCreators.ts +18 -0
  45. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +0 -6
  46. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.module.css +4 -0
  47. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.tsx +24 -0
  48. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/constants/helloWorldConstants.ts +6 -0
  49. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/containers/HelloWorldContainer.ts +20 -0
  50. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/reducers/helloWorldReducer.ts +22 -0
  51. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/startup/HelloWorldApp.client.tsx +23 -0
  52. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/startup/HelloWorldApp.server.jsx +5 -0
  53. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/startup/HelloWorldApp.server.tsx +5 -0
  54. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/store/helloWorldStore.ts +18 -0
  55. data/lib/react_on_rails/configuration.rb +15 -11
  56. data/lib/react_on_rails/controller.rb +5 -3
  57. data/lib/react_on_rails/dev/file_manager.rb +78 -0
  58. data/lib/react_on_rails/dev/pack_generator.rb +27 -0
  59. data/lib/react_on_rails/dev/process_manager.rb +61 -0
  60. data/lib/react_on_rails/dev/server_manager.rb +487 -0
  61. data/lib/react_on_rails/dev.rb +20 -0
  62. data/lib/react_on_rails/doctor.rb +1149 -0
  63. data/lib/react_on_rails/engine.rb +6 -0
  64. data/lib/react_on_rails/git_utils.rb +12 -2
  65. data/lib/react_on_rails/helper.rb +19 -44
  66. data/lib/react_on_rails/packer_utils.rb +4 -18
  67. data/lib/react_on_rails/packs_generator.rb +134 -8
  68. data/lib/react_on_rails/pro/NOTICE +21 -0
  69. data/lib/react_on_rails/pro/helper.rb +122 -0
  70. data/lib/react_on_rails/pro/utils.rb +53 -0
  71. data/lib/react_on_rails/react_component/render_options.rb +8 -4
  72. data/lib/react_on_rails/server_rendering_js_code.rb +0 -1
  73. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +1 -0
  74. data/lib/react_on_rails/system_checker.rb +659 -0
  75. data/lib/react_on_rails/test_helper/webpack_assets_status_checker.rb +1 -0
  76. data/lib/react_on_rails/utils.rb +16 -1
  77. data/lib/react_on_rails/version.rb +1 -1
  78. data/lib/react_on_rails/version_syntax_converter.rb +1 -1
  79. data/lib/react_on_rails.rb +1 -0
  80. data/lib/tasks/doctor.rake +51 -0
  81. data/lib/tasks/generate_packs.rake +144 -1
  82. data/package-lock.json +11984 -0
  83. data/react_on_rails.gemspec +1 -0
  84. metadata +55 -11
  85. data/REACT-ON-RAILS-PRO-LICENSE +0 -95
  86. data/lib/generators/react_on_rails/adapt_for_older_shakapacker_generator.rb +0 -41
  87. data/lib/generators/react_on_rails/bin/dev +0 -30
  88. data/lib/generators/react_on_rails/bin/dev-static +0 -30
  89. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-static.tt +0 -9
  90. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt +0 -5
  91. data/lib/generators/react_on_rails/templates/base/base/app/javascript/packs/registration.js.tt +0 -8
  92. /data/lib/generators/react_on_rails/templates/base/base/config/webpack/{webpackConfig.js.tt → generateWebpackConfigs.js.tt} +0 -0
  93. /data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/startup/{HelloWorldApp.jsx → HelloWorldApp.client.jsx} +0 -0
data/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ---
11
11
 
12
- [![License](https://img.shields.io/badge/license-mit-green.svg)](LICENSE.md)[![Gem Version](https://badge.fury.io/rb/react_on_rails.svg)](https://badge.fury.io/rb/react_on_rails) [![npm version](https://badge.fury.io/js/react-on-rails.svg)](https://badge.fury.io/js/react-on-rails) [![Code Climate](https://codeclimate.com/github/shakacode/react_on_rails/badges/gpa.svg)](https://codeclimate.com/github/shakacode/react_on_rails) [![Coverage Status](https://coveralls.io/repos/shakacode/react_on_rails/badge.svg?branch=master&service=github)](https://coveralls.io/github/shakacode/react_on_rails?branch=master) [![](https://ruby-gem-downloads-badge.herokuapp.com/react_on_rails?type=total)](https://rubygems.org/gems/react_on_rails)
12
+ [![License](https://img.shields.io/badge/license-mit-green.svg)](LICENSE.md)[![Gem Version](https://badge.fury.io/rb/react_on_rails.svg)](https://badge.fury.io/rb/react_on_rails) [![npm version](https://badge.fury.io/js/react-on-rails.svg)](https://badge.fury.io/js/react-on-rails) [![Coverage Status](https://coveralls.io/repos/shakacode/react_on_rails/badge.svg?branch=master&service=github)](https://coveralls.io/github/shakacode/react_on_rails?branch=master) [![](https://ruby-gem-downloads-badge.herokuapp.com/react_on_rails?type=total)](https://rubygems.org/gems/react_on_rails)
13
13
 
14
14
  [![Build Main](https://github.com/shakacode/react_on_rails/actions/workflows/main.yml/badge.svg)](https://github.com/shakacode/react_on_rails/actions/workflows/main.yml)
15
15
  [![Build JS Tests](https://github.com/shakacode/react_on_rails/actions/workflows/package-js-tests.yml/badge.svg)](https://github.com/shakacode/react_on_rails/actions/workflows/package-js-tests.yml)
@@ -18,13 +18,18 @@
18
18
 
19
19
  # News
20
20
 
21
+ **🚀 React on Rails v16.0 Released!** Major modernization with ESM support, enhanced React Server Components, and streamlined configuration.
22
+
23
+ - **ESM-only package**: Modern module system with better tree-shaking and performance
24
+ - **React Server Components**: Improved rendering flow and new `RSCRoute` component for seamless SSR
25
+ - **Performance improvements**: New async loading strategies and optimized bundle generation
26
+ - **Webpacker removal**: Streamlined for Shakapacker-only support (>= 6.0)
21
27
  - [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro/) supports the latest features of React 18, including [React Server Components](https://react.dev/reference/rsc/server-components) and [streaming](https://react.dev/reference/react-dom/server/renderToPipeableStream). Contact [Justin Gordon](mailto:justin@shakacode.com) for more information.
22
28
  - ShakaCode now maintains the official successor to `rails/webpacker`, [`shakapacker`](https://github.com/shakacode/shakapacker).
23
- - Project is updated to support Rails 7 and Shakapacker v6+!
24
29
 
25
30
  ---
26
31
 
27
- _These are the docs for React on Rails 14. To see the older docs and code: [v13](https://github.com/shakacode/react_on_rails/tree/13.4.0), [v12](https://github.com/shakacode/react_on_rails/tree/12.6.0), and [v11](https://github.com/shakacode/react_on_rails/tree/11.3.0)._
32
+ _These are the docs for React on Rails 16. To see the older docs and code: [v14](https://github.com/shakacode/react_on_rails/tree/14.0.0), [v13](https://github.com/shakacode/react_on_rails/tree/13.4.0), [v12](https://github.com/shakacode/react_on_rails/tree/12.6.0), and [v11](https://github.com/shakacode/react_on_rails/tree/11.3.0)._
28
33
 
29
34
  # About
30
35
 
@@ -42,16 +47,55 @@ We also specialize in helping development teams lower infrastructure and CI cost
42
47
 
43
48
  If you think ShakaCode can help your project, [click here](https://meetings.hubspot.com/justingordon/30-minute-consultation) to book a call with [Justin Gordon](mailto:justin@shakacode.com), the creator of React on Rails.
44
49
 
50
+ ## Upgrading React on Rails
51
+
52
+ After upgrading to a new major version, run the generator to get latest defaults:
53
+
54
+ ```bash
55
+ rails generate react_on_rails:install
56
+ ```
57
+
58
+ **Important**: Review changes carefully before applying to avoid overwriting custom configurations. The generator updates:
59
+
60
+ - `bin/dev` (improved development workflow)
61
+ - webpack configurations
62
+ - `shakapacker.yml` settings
63
+ - other configuration files
64
+
65
+ ### Troubleshooting Setup Issues
66
+
67
+ If you encounter issues during installation or after upgrading, use the doctor command to diagnose your setup:
68
+
69
+ ```bash
70
+ rake react_on_rails:doctor
71
+ ```
72
+
73
+ 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.
74
+
75
+ For detailed upgrade instructions, see [upgrade guide documentation](docs/guides/upgrading-react-on-rails.md).
76
+
45
77
  ## React on Rails Pro
46
78
 
47
- Are you interested in optimizing your Webpack setup for React on Rails, including code splitting with [React Router](https://reactrouter.com/) and [loadable-components](https://loadable-components.com/) with server-side rendering for SEO and hot-reloading for developers?
79
+ Some features of React on Rails regarding performance require a React on Rails Pro subscription.
80
+
81
+ Note: the subscription price is free for evaluation and non-production use.
82
+
83
+ Notable new features include:
84
+
85
+ - React Server Components
86
+ - Streaming SSR
87
+ - Loadable Components
88
+ - Code Splitting with React Router
89
+
90
+ React on Rails Pro is the best way to optimize your Webpack setup for React on Rails, including code splitting with [React Router](https://reactrouter.com/) and [loadable-components](https://loadable-components.com/) with server-side rendering for SEO and hot-reloading for developers.
91
+
48
92
  We did this for Popmenu, [lowering Heroku costs 20-25% while getting a 73% decrease in average response times](https://www.shakacode.com/recent-work/popmenu/). Several years later, Popmenu serves tens of millions of SSR requests daily with React on Rails Pro.
49
93
 
50
94
  If you're interested, read more about [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro/) and [book a call](https://meetings.hubspot.com/justingordon/30-minute-consultation).
51
95
 
52
96
  # Documentation
53
97
 
54
- See the documentation at **[shakacode.com/react-on-rails/docs](https://www.shakacode.com/react-on-rails/docs/)**.
98
+ See the documentation at **[shakacode.com/react-on-rails/docs](https://www.shakacode.com/react-on-rails/docs/)** and [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro/).
55
99
 
56
100
  ## Project Objective
57
101
 
@@ -61,18 +105,20 @@ To provide a high-performance framework for integrating Ruby on Rails with React
61
105
 
62
106
  Given that `shakacode/shakapacker` gem already provides basic React integration, why would you use "React on Rails"?
63
107
 
64
- 1. Automatic configuration of what bundles are added to the page based on what React components are on the page. This results in faster browser loading time via smaller bundle sizes.
65
- 1. Keep up with the latest changes in different versions of React. React 18 is supported.
66
- 1. Easy passing of props directly from your Rails view to your React components rather than having your Rails view load and then make a separate request to your API.
67
- Tight integration with [shakapacker](https://github.com/shakacode/shakapacker) (or its predecessor [rails/webpacker](https://github.com/rails/webpacker)).
68
- 1. Server-Side Rendering (SSR), often used for SEO crawler indexing and UX performance.
69
- 1. [Automated optimized entry-point creation and bundle inclusion when placing a component on a page. With this feature, you no longer need to configure `javascript_pack_tags` and `stylesheet_pack_tags` on your layouts based on what’s shown. “It just works!”](https://www.shakacode.com/react-on-rails/docs/guides/file-system-based-automated-bundle-generation/)
70
- 1. [Redux](https://redux.js.org/) and [React Router](https://reactrouter.com/) integration with server-side-rendering.
71
- 1. [Internationalization (I18n) and (localization)](https://www.shakacode.com/react-on-rails/docs/guides/i18n)
72
- 1. A supportive community. This [web search shows how live public sites are using React on Rails](https://publicwww.com/websites/%22react-on-rails%22++-undeveloped.com+depth%3Aall/).
73
- 1. [ReScript Support](https://github.com/shakacode/rescript-react-on-rails-example).
74
-
75
- See [Rails/Webpacker React Integration Options](https://www.shakacode.com/react-on-rails/docs/guides/rails-webpacker-react-integration-options) for comparisons to other gems.
108
+ 1. **Modern ESM-only package** with optimized tree-shaking for smaller bundle sizes and better performance.
109
+ 1. **Advanced loading strategies** with `sync`, `async`, and `defer` options for optimal performance based on your needs.
110
+ 1. **Automatic configuration** of what bundles are added to the page based on what React components are on the page. This results in faster browser loading time via smaller bundle sizes.
111
+ 1. **Keep up with the latest changes** in different versions of React. React 18+ is fully supported with enhanced React Server Components.
112
+ 1. **Easy prop passing** directly from your Rails view to your React components rather than having your Rails view load and then make a separate request to your API.
113
+ Tight integration with [shakapacker](https://github.com/shakacode/shakapacker).
114
+ 1. **Server-Side Rendering (SSR)** with enhanced React Server Components support, often used for SEO crawler indexing and UX performance.
115
+ 1. **[Automated optimized entry-point creation and bundle inclusion](https://www.shakacode.com/react-on-rails/docs/guides/file-system-based-automated-bundle-generation/)** when placing a component on a page. With this feature, you no longer need to configure `javascript_pack_tags` and `stylesheet_pack_tags` on your layouts based on what's shown. "It just works!"
116
+ 1. **[Redux](https://redux.js.org/) and [React Router](https://reactrouter.com/) integration** with server-side-rendering.
117
+ 1. **[Internationalization (I18n) and (localization)](https://www.shakacode.com/react-on-rails/docs/guides/i18n)** support.
118
+ 1. **Supportive community**. This [web search shows how live public sites are using React on Rails](https://publicwww.com/websites/%22react-on-rails%22++-undeveloped.com+depth%3Aall/).
119
+ 1. **[ReScript Support](https://github.com/shakacode/rescript-react-on-rails-example)**.
120
+
121
+ See [Rails/Shakapacker React Integration Options](https://www.shakacode.com/react-on-rails/docs/guides/rails-webpacker-react-integration-options) for comparisons to other gems.
76
122
 
77
123
  ## Online demo
78
124
 
@@ -88,7 +134,11 @@ _Requires creating a free account._
88
134
 
89
135
  ## Prerequisites
90
136
 
91
- Ruby on Rails >=5, rails/webpacker >= 4.2 or shakapacker > 6, Ruby >= 3.0.0
137
+ - Ruby on Rails >= 5
138
+ - Shakapacker >= 6.0 (Webpacker is no longer supported as of v16)
139
+ - Ruby >= 3.2 (CI tested: 3.2 - 3.4)
140
+ - Node.js >= 20 (CI tested: 20 - 22)
141
+ - A JavaScript package manager (npm, yarn, pnpm, or bun)
92
142
 
93
143
  # Support
94
144
 
@@ -120,8 +170,8 @@ The following companies support our open-source projects, and ShakaCode uses the
120
170
  <br />
121
171
  <br />
122
172
 
123
- <a href="https://www.jetbrains.com">
124
- <img src="https://user-images.githubusercontent.com/4244251/184881139-42e4076b-024b-4b30-8c60-c3cd0e758c0a.png" alt="JetBrains" height="120px">
173
+ <a href="https://jb.gg/OpenSource" style="margin-right: 20px;">
174
+ <img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.png" alt="JetBrains" height="120px">
125
175
  </a>
126
176
  <a href="https://scoutapp.com">
127
177
  <picture>
data/TODO.md ADDED
@@ -0,0 +1,135 @@
1
+ # React on Rails TODO
2
+
3
+ ## Generator Improvements
4
+
5
+ ### HelloWorld Component Structure
6
+
7
+ - [x] Fix bad import in HelloWorld.server.jsx (server importing from client)
8
+ - [x] Simplify to single HelloWorld.jsx file with documentation
9
+ - [ ] **Consider alternative approach**: Create second example component showing client/server split
10
+ - Add `client_server_different.jsx` in sibling directory like `/examples/` or `/advanced/`
11
+ - Show real-world use case (React Router, styled-components, etc.)
12
+ - Keep HelloWorld simple for beginners
13
+
14
+ ### File Organization
15
+
16
+ - [x] **Improved ror_components directory structure**
17
+ - Documentation now suggests moving shared components to `../components/` directory
18
+ - Keeps ror_components clean for React on Rails specific entry points
19
+ - Recommended structure:
20
+ ```
21
+ src/HelloWorld/
22
+ ├── components/
23
+ │ └── HelloWorld.jsx # Shared component implementation
24
+ └── ror_components/
25
+ ├── HelloWorld.client.jsx # Client entry point (when needed)
26
+ └── HelloWorld.server.jsx # Server entry point (when needed)
27
+ ```
28
+ - [ ] **Consider adding generator flag to create this structure automatically**
29
+
30
+ ### Generator Options
31
+
32
+ - [ ] **Add generator flags for different patterns**
33
+ - `--simple` (default): Single component file
34
+ - `--split`: Generate client/server split example
35
+ - `--example-name`: Customize component name beyond HelloWorld
36
+
37
+ ## Documentation Improvements
38
+
39
+ ### Component Architecture Guide
40
+
41
+ - [ ] **Add comprehensive docs on client/server patterns**
42
+ - When to use single vs split files
43
+ - Common libraries requiring server setup (React Router, styled-components, Apollo)
44
+ - Migration path from simple to split architecture
45
+ - Auto-registration behavior explanation
46
+
47
+ ### Code Comments
48
+
49
+ - [x] Add inline documentation to HelloWorld.jsx explaining split pattern
50
+ - [ ] Add JSDoc comments for better IDE support
51
+ - [ ] Include links to relevant documentation sections
52
+
53
+ ## Testing Infrastructure
54
+
55
+ - [ ] **Test generator output for both simple and split patterns**
56
+ - [ ] **Validate that auto-registration works correctly**
57
+ - [ ] **Add integration tests for client/server rendering differences**
58
+
59
+ ## Developer Experience
60
+
61
+ - [ ] **bin/dev help command enhancements**
62
+
63
+ - [x] Add emojis and colors for better readability
64
+ - [ ] Add section about component development patterns
65
+ - [ ] Include troubleshooting for client/server split issues
66
+
67
+ - [ ] **Babel Configuration Conflict Detection**
68
+
69
+ - [ ] Add validation in generator/initializer to detect conflicting Babel configs
70
+ - [ ] Improve error messaging for duplicate preset issues
71
+ - [ ] Common conflict: babel.config.js + package.json "babel" section
72
+ - [ ] Specific guidance for yalc development workflow
73
+ - [ ] Add troubleshooting section for this common issue:
74
+
75
+ ```
76
+ ❌ BABEL CONFIGURATION CONFLICT DETECTED
77
+ Found duplicate Babel configurations:
78
+ • babel.config.js ✓ (recommended)
79
+ • package.json "babel" section ❌ (conflicting)
80
+
81
+ 🔧 FIX: Remove the "babel" section from package.json
82
+ ```
83
+
84
+ ### IDE Support
85
+
86
+ - [ ] **Improve TypeScript support**
87
+ - Add .d.ts files for better type inference
88
+ - Document TypeScript patterns for client/server split
89
+ - Consider TypeScript generator templates
90
+
91
+ ## Performance & Bundle Analysis
92
+
93
+ - [ ] **Bundle splitting documentation**
94
+ - How React on Rails handles client/server bundles
95
+ - Best practices for code splitting
96
+ - webpack bundle analysis guidance
97
+
98
+ ## Real-World Examples
99
+
100
+ - [ ] **Create example apps showing advanced patterns**
101
+ - React Router with SSR
102
+ - styled-components with server-side rendering
103
+ - Apollo Client hydration
104
+ - Next.js-style patterns
105
+
106
+ ## Migration Guide
107
+
108
+ - [ ] **Document upgrade paths**
109
+ - Converting from Webpacker to Shakapacker
110
+ - Migrating from single to split components
111
+ - Updating existing projects to new patterns
112
+
113
+ ## Community & Ecosystem
114
+
115
+ - [ ] **Plugin ecosystem considerations**
116
+ - Standard patterns for community components
117
+ - Guidelines for React on Rails compatible libraries
118
+ - Template repository for component patterns
119
+
120
+ ---
121
+
122
+ ## Current Known Issues
123
+
124
+ - Generator installer still has remaining issues (mentioned in context)
125
+ - Version mismatch warnings with yalc during development
126
+ - Need clearer documentation on when to use different patterns
127
+ - **Babel configuration conflicts** - Common during yalc development when package.json and babel.config.js both define presets
128
+
129
+ ## Priority Order
130
+
131
+ 1. Fix remaining generator installer issues
132
+ 2. Improve HelloWorld component documentation
133
+ 3. Add alternative example showing client/server split
134
+ 4. Create comprehensive architecture documentation
135
+ 5. Add generator flags for different patterns
data/eslint.config.ts CHANGED
@@ -44,6 +44,9 @@ const config = tsEslint.config([
44
44
  // fixtures
45
45
  '**/fixtures/',
46
46
  '**/.yalc/**/*',
47
+ // generator templates - exclude TypeScript templates that need tsconfig.json
48
+ '**/templates/**/*.tsx',
49
+ '**/templates/**/*.ts',
47
50
  ]),
48
51
  {
49
52
  files: ['**/*.[jt]s', '**/*.[jt]sx', '**/*.[cm][jt]s'],
@@ -152,6 +155,8 @@ const config = tsEslint.config([
152
155
  'import/no-unresolved': 'off',
153
156
  // We have `const [name, setName] = useState(props.name)` so can't just destructure props
154
157
  'react/destructuring-assignment': 'off',
158
+ // React 19 doesn't need PropTypes - we're targeting modern React
159
+ 'react/prop-types': 'off',
155
160
  },
156
161
  },
157
162
  {
data/knip.ts CHANGED
@@ -6,21 +6,32 @@ const config: KnipConfig = {
6
6
  '.': {
7
7
  entry: [
8
8
  'node_package/src/ReactOnRails.node.ts!',
9
- 'node_package/src/ReactOnRailsRSC.ts!',
10
- 'node_package/src/registerServerComponent/client.tsx!',
11
- 'node_package/src/registerServerComponent/server.tsx!',
12
- 'node_package/src/registerServerComponent/server.rsc.ts!',
13
- 'node_package/src/wrapServerComponentRenderer/server.tsx!',
14
- 'node_package/src/wrapServerComponentRenderer/server.rsc.tsx!',
15
- 'node_package/src/RSCRoute.tsx!',
16
- 'node_package/src/ServerComponentFetchError.ts!',
9
+ 'node_package/src/pro/ReactOnRailsRSC.ts!',
10
+ 'node_package/src/pro/registerServerComponent/client.tsx!',
11
+ 'node_package/src/pro/registerServerComponent/server.tsx!',
12
+ 'node_package/src/pro/registerServerComponent/server.rsc.ts!',
13
+ 'node_package/src/pro/wrapServerComponentRenderer/server.tsx!',
14
+ 'node_package/src/pro/wrapServerComponentRenderer/server.rsc.tsx!',
15
+ 'node_package/src/pro/RSCRoute.tsx!',
16
+ 'node_package/src/pro/ServerComponentFetchError.ts!',
17
+ 'node_package/src/pro/getReactServerComponent.server.ts!',
18
+ 'node_package/src/pro/transformRSCNodeStream.ts!',
19
+ 'node_package/src/loadJsonFile.ts!',
17
20
  'eslint.config.ts',
18
21
  ],
19
22
  project: ['node_package/src/**/*.[jt]s{x,}!', 'node_package/tests/**/*.[jt]s{x,}'],
20
23
  babel: {
21
24
  config: ['node_package/babel.config.js'],
22
25
  },
23
- ignore: ['node_package/tests/emptyForTesting.js'],
26
+ ignore: [
27
+ 'node_package/tests/emptyForTesting.js',
28
+ // Pro features exported for external consumption
29
+ 'node_package/src/pro/streamServerRenderedReactComponent.ts:transformRenderStreamChunksToResultObject',
30
+ 'node_package/src/pro/streamServerRenderedReactComponent.ts:streamServerRenderedComponent',
31
+ 'node_package/src/pro/ServerComponentFetchError.ts:isServerComponentFetchError',
32
+ 'node_package/src/pro/RSCRoute.tsx:RSCRouteProps',
33
+ 'node_package/src/pro/streamServerRenderedReactComponent.ts:StreamingTrackers',
34
+ ],
24
35
  ignoreBinaries: [
25
36
  // Knip fails to detect it's declared in devDependencies
26
37
  'nps',
data/lib/generators/USAGE CHANGED
@@ -1,9 +1,8 @@
1
1
  Description:
2
2
 
3
- The react_on_rails:install generator integrates Webpack with Rails with ease. You
4
- can pass the redux option if you'd like to have redux setup for you automatically.
3
+ The react_on_rails:install generator integrates a React frontend, including SSR, with Rails.
5
4
 
6
- * Redux
5
+ * Redux (Optional)
7
6
 
8
7
  Passing the --redux generator option causes the generated Hello World example
9
8
  to integrate the Redux state container framework. The necessary node modules
@@ -13,11 +12,11 @@ can pass the redux option if you'd like to have redux setup for you automaticall
13
12
 
14
13
  After running the generator, you will want to:
15
14
 
16
- bundle && yarn
15
+ bundle && npm install # or yarn install, or pnpm install
17
16
 
18
17
  Then you may run
19
18
 
20
- foreman start -f Procfile.dev
19
+ ./bin/dev
21
20
 
22
21
  More Details:
23
22
 
@@ -0,0 +1,65 @@
1
+ Description:
2
+ The `react_on_rails:doctor` generator diagnoses your React on Rails setup
3
+ and identifies potential configuration issues. It performs comprehensive
4
+ checks on your environment, dependencies, and configuration files.
5
+
6
+ This command is especially useful for:
7
+ • Troubleshooting setup issues
8
+ • Verifying installation after running react_on_rails:install
9
+ • Ensuring compatibility after upgrades
10
+ • Getting help with configuration problems
11
+
12
+ Example:
13
+ # Basic diagnosis
14
+ rails generate react_on_rails:doctor
15
+
16
+ # Verbose output showing all checks
17
+ rails generate react_on_rails:doctor --verbose
18
+
19
+ # Show help
20
+ rails generate react_on_rails:doctor --help
21
+
22
+ Checks performed:
23
+ Environment Prerequisites:
24
+ • Node.js installation and version compatibility
25
+ • JavaScript package manager availability (npm, yarn, pnpm, bun)
26
+ • Git working directory status
27
+
28
+ React on Rails Packages:
29
+ • React on Rails gem installation
30
+ • react-on-rails NPM package installation
31
+ • Version synchronization between gem and NPM package
32
+ • Shakapacker configuration and installation
33
+
34
+ Dependencies:
35
+ • React and React DOM installation
36
+ • Babel preset configuration
37
+ • Required development dependencies
38
+
39
+ Rails Integration:
40
+ • React on Rails initializer configuration
41
+ • Route and controller setup (Hello World example)
42
+ • View helper integration
43
+
44
+ Webpack Configuration:
45
+ • Webpack config file existence and structure
46
+ • React on Rails compatibility checks
47
+ • Environment-specific configuration validation
48
+
49
+ Development Environment:
50
+ • JavaScript bundle files
51
+ • Procfile.dev for development workflow
52
+ • .gitignore configuration for generated files
53
+
54
+ Options:
55
+ --verbose, -v: Show detailed output for all checks, including successful ones
56
+ --fix, -f: Attempt to fix simple issues automatically (planned feature)
57
+
58
+ Exit codes:
59
+ 0: All checks passed or only warnings found
60
+ 1: Critical errors found that prevent React on Rails from working
61
+
62
+ For more help:
63
+ • Documentation: https://github.com/shakacode/react_on_rails
64
+ • Issues: https://github.com/shakacode/react_on_rails/issues
65
+ • Discord: https://discord.gg/reactrails