react_on_rails 16.1.2 → 16.2.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 (106) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -0
  3. data/.rubocop.yml +85 -0
  4. data/Gemfile.development_dependencies +8 -7
  5. data/Gemfile.lock +158 -119
  6. data/Steepfile +56 -0
  7. data/lib/generators/react_on_rails/base_generator.rb +43 -120
  8. data/lib/generators/react_on_rails/dev_tests_generator.rb +2 -1
  9. data/lib/generators/react_on_rails/generator_helper.rb +102 -2
  10. data/lib/generators/react_on_rails/install_generator.rb +36 -156
  11. data/lib/generators/react_on_rails/js_dependency_manager.rb +383 -0
  12. data/lib/generators/react_on_rails/templates/base/base/.dev-services.yml.example +76 -0
  13. data/lib/generators/react_on_rails/templates/base/base/bin/shakapacker-precompile-hook +30 -0
  14. data/lib/generators/react_on_rails/templates/base/base/bin/switch-bundler +141 -0
  15. data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt +44 -45
  16. data/lib/generators/react_on_rails/templates/base/base/config/{shakapacker.yml → shakapacker.yml.tt} +28 -3
  17. data/lib/generators/react_on_rails/templates/base/base/config/webpack/development.js.tt +15 -9
  18. data/lib/generators/react_on_rails/templates/base/base/config/webpack/serverWebpackConfig.js.tt +42 -6
  19. data/lib/react_on_rails/configuration.rb +149 -32
  20. data/lib/react_on_rails/controller.rb +3 -3
  21. data/lib/react_on_rails/dev/pack_generator.rb +168 -2
  22. data/lib/react_on_rails/dev/process_manager.rb +136 -14
  23. data/lib/react_on_rails/dev/server_manager.rb +194 -26
  24. data/lib/react_on_rails/dev/service_checker.rb +200 -0
  25. data/lib/react_on_rails/doctor.rb +341 -12
  26. data/lib/react_on_rails/engine.rb +75 -1
  27. data/lib/react_on_rails/git_utils.rb +3 -1
  28. data/lib/react_on_rails/helper.rb +70 -192
  29. data/lib/react_on_rails/locales/base.rb +17 -5
  30. data/lib/react_on_rails/packer_utils.rb +79 -2
  31. data/lib/react_on_rails/packs_generator.rb +57 -39
  32. data/lib/react_on_rails/prerender_error.rb +74 -17
  33. data/lib/react_on_rails/pro_helper.rb +64 -0
  34. data/lib/react_on_rails/react_component/render_options.rb +7 -7
  35. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +2 -5
  36. data/lib/react_on_rails/smart_error.rb +326 -0
  37. data/lib/react_on_rails/system_checker.rb +8 -9
  38. data/lib/react_on_rails/test_helper/webpack_assets_status_checker.rb +16 -7
  39. data/lib/react_on_rails/utils.rb +241 -55
  40. data/lib/react_on_rails/version.rb +1 -1
  41. data/lib/react_on_rails/version_checker.rb +383 -35
  42. data/lib/tasks/generate_packs.rake +12 -6
  43. data/lib/tasks/locale.rake +6 -1
  44. data/rakelib/docker.rake +26 -0
  45. data/rakelib/dummy_apps.rake +30 -0
  46. data/rakelib/example_type.rb +121 -0
  47. data/rakelib/examples_config.yml +52 -0
  48. data/rakelib/lint.rake +52 -0
  49. data/rakelib/node_package.rake +15 -0
  50. data/rakelib/rbs.rake +70 -0
  51. data/rakelib/run_rspec.rake +223 -0
  52. data/rakelib/shakapacker_examples.rake +171 -0
  53. data/rakelib/task_helpers.rb +134 -0
  54. data/rakelib/update_changelog.rake +73 -0
  55. data/react_on_rails.gemspec +4 -3
  56. data/sig/README.md +52 -0
  57. data/sig/react_on_rails/configuration.rbs +96 -0
  58. data/sig/react_on_rails/controller.rbs +15 -0
  59. data/sig/react_on_rails/dev/file_manager.rbs +15 -0
  60. data/sig/react_on_rails/dev/pack_generator.rbs +19 -0
  61. data/sig/react_on_rails/dev/process_manager.rbs +22 -0
  62. data/sig/react_on_rails/dev/server_manager.rbs +39 -0
  63. data/sig/react_on_rails/dev/service_checker.rbs +22 -0
  64. data/sig/react_on_rails/error.rbs +4 -0
  65. data/sig/react_on_rails/generators/js_dependency_manager.rbs +123 -0
  66. data/sig/react_on_rails/git_utils.rbs +8 -0
  67. data/sig/react_on_rails/helper.rbs +65 -0
  68. data/sig/react_on_rails/json_parse_error.rbs +10 -0
  69. data/sig/react_on_rails/locales.rbs +46 -0
  70. data/sig/react_on_rails/packer_utils.rbs +15 -0
  71. data/sig/react_on_rails/prerender_error.rbs +21 -0
  72. data/sig/react_on_rails/server_rendering_pool.rbs +12 -0
  73. data/sig/react_on_rails/smart_error.rbs +28 -0
  74. data/sig/react_on_rails/test_helper.rbs +11 -0
  75. data/sig/react_on_rails/utils.rbs +34 -0
  76. data/sig/react_on_rails/version_checker.rbs +12 -0
  77. data/sig/react_on_rails.rbs +17 -0
  78. metadata +49 -32
  79. data/AI_AGENT_INSTRUCTIONS.md +0 -63
  80. data/CHANGELOG.md +0 -1836
  81. data/CLAUDE.md +0 -135
  82. data/CODING_AGENTS.md +0 -313
  83. data/CONTRIBUTING.md +0 -668
  84. data/Dockerfile_tests +0 -12
  85. data/KUDOS.md +0 -114
  86. data/LICENSE.md +0 -47
  87. data/LICENSES/README.md +0 -14
  88. data/NEWS.md +0 -62
  89. data/PROJECTS.md +0 -63
  90. data/REACT-ON-RAILS-PRO-LICENSE.md +0 -129
  91. data/README.md +0 -217
  92. data/SUMMARY.md +0 -88
  93. data/TODO.md +0 -135
  94. data/bin/lefthook/check-trailing-newlines +0 -38
  95. data/bin/lefthook/get-changed-files +0 -26
  96. data/bin/lefthook/prettier-format +0 -26
  97. data/bin/lefthook/ruby-autofix +0 -26
  98. data/bin/lefthook/ruby-lint +0 -27
  99. data/docker-compose.yml +0 -11
  100. data/eslint.config.ts +0 -232
  101. data/knip.ts +0 -114
  102. data/lib/react_on_rails/pro/NOTICE +0 -21
  103. data/lib/react_on_rails/pro/helper.rb +0 -122
  104. data/lib/react_on_rails/pro/utils.rb +0 -53
  105. data/tsconfig.eslint.json +0 -6
  106. data/tsconfig.json +0 -19
data/README.md DELETED
@@ -1,217 +0,0 @@
1
- ![reactrails](https://user-images.githubusercontent.com/10421828/79436261-52159b80-7fd9-11ea-994e-2a98dd43e540.png)
2
-
3
- <p align="center">
4
- <a href="https://shakacode.com/"><img src="https://user-images.githubusercontent.com/10421828/79436256-517d0500-7fd9-11ea-9300-dfbc7c293f26.png"></a>
5
- <a href="https://forum.shakacode.com/"><img src="https://user-images.githubusercontent.com/10421828/79436266-53df5f00-7fd9-11ea-94b3-b985e1b05bdc.png"></a>
6
- <a href="https://www.shakacode.com/react-on-rails-pro"><img src="https://user-images.githubusercontent.com/10421828/79436265-53df5f00-7fd9-11ea-8220-fc474f6a856c.png"></a>
7
- <a href="https://github.com/sponsors/shakacode"><img src="https://user-images.githubusercontent.com/10421828/79466109-cdd90d80-8004-11ea-88e5-25f9a9ddcf44.png"></a>
8
- </p>
9
-
10
- ---
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) [![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
-
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
- [![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)
16
- [![Build Rspec Tests](https://github.com/shakacode/react_on_rails/actions/workflows/rspec-package-specs.yml/badge.svg)](https://github.com/shakacode/react_on_rails/actions/workflows/rspec-package-specs.yml)
17
- [![Linting](https://github.com/shakacode/react_on_rails/actions/workflows/lint-js-and-ruby.yml/badge.svg)](https://github.com/shakacode/react_on_rails/actions/workflows/lint-js-and-ruby.yml)
18
-
19
- # ⚡ What's New
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)
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.
28
- - ShakaCode now maintains the official successor to `rails/webpacker`, [`shakapacker`](https://github.com/shakacode/shakapacker).
29
-
30
- ---
31
-
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)._
33
-
34
- # 🎯 About React on Rails
35
-
36
- **Seamlessly integrate React components into your Rails application** with server-side rendering, hot reloading, and automatic bundle optimization.
37
-
38
- > **"The easiest way to add React to Rails"** - Thousands of developers rely on React on Rails for production applications.
39
-
40
- This project is maintained by [ShakaCode](https://www.shakacode.com) with ❤️ from the Rails and React communities.
41
-
42
- ## ShakaCode Upgrade Support
43
-
44
- ShakaCode focuses on helping Ruby on Rails teams better use React and Webpack. We can upgrade your project and improve your development and customer experiences, allowing you to focus on building new features or fixing bugs instead.
45
-
46
- For an overview of working with us, see our [Client Engagement Model](https://www.shakacode.com/blog/client-engagement-model/) article and [how we bill for time](https://www.shakacode.com/blog/shortcut-jira-trello-github-toggl-time-and-task-tracking/).
47
-
48
- We also specialize in helping development teams lower infrastructure and CI costs. Check out our project [Control Plane Flow](https://github.com/shakacode/control-plane-flow/), which can allow you to get the ease of Heroku with the power of Kubernetes and big cost savings.
49
-
50
- 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.
51
-
52
- ## Upgrading React on Rails
53
-
54
- After upgrading to a new major version, run the generator to get latest defaults:
55
-
56
- ```bash
57
- rails generate react_on_rails:install
58
- ```
59
-
60
- **Important**: Review changes carefully before applying to avoid overwriting custom configurations. The generator updates:
61
-
62
- - `bin/dev` (improved development workflow)
63
- - webpack configurations
64
- - `shakapacker.yml` settings
65
- - other configuration files
66
-
67
- ### Troubleshooting Setup Issues
68
-
69
- If you encounter issues during installation or after upgrading, use the doctor command to diagnose your setup:
70
-
71
- ```bash
72
- rake react_on_rails:doctor
73
- ```
74
-
75
- 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.
76
-
77
- For detailed upgrade instructions, see [upgrade guide documentation](docs/guides/upgrading-react-on-rails.md).
78
-
79
- ## React on Rails Pro
80
-
81
- Some features of React on Rails regarding performance require a React on Rails Pro subscription.
82
-
83
- Note: the subscription price is free for evaluation and non-production use.
84
-
85
- Notable new features include:
86
-
87
- - React Server Components
88
- - Streaming SSR
89
- - Loadable Components
90
- - Code Splitting with React Router
91
-
92
- 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.
93
-
94
- 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.
95
-
96
- 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).
97
-
98
- # 📚 Quick Start
99
-
100
- **New to React on Rails?** Get up and running in minutes:
101
-
102
- 🚀 **[15-Minute Quick Start](https://www.shakacode.com/react-on-rails/docs/quick-start/)** - Your first React component
103
- 📖 **[Complete Documentation](https://www.shakacode.com/react-on-rails/docs/)** - Comprehensive guides and API reference
104
- 🎮 **[Live Demo](https://reactrails.com)** - See it in action with [source code](https://github.com/shakacode/react-webpack-rails-tutorial)
105
-
106
- ## Project Objective
107
-
108
- To provide a high-performance framework for integrating Ruby on Rails with React, especially regarding React Server-Side Rendering for better SEO and improved performance.
109
-
110
- ## ✨ Why React on Rails?
111
-
112
- | Feature | Benefit |
113
- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
114
- | 🎯 **Smart Bundle Loading** | [Automated bundle optimization](./docs/guides/auto-bundling-file-system-based-automated-bundle-generation.md) based on components used - no more manual `javascript_pack_tags` configuration |
115
- | ⚡ **Server-Side Rendering** | Enhanced React Server Components support for better SEO and UX performance |
116
- | 🚀 **Advanced Loading** | `sync`, `async`, and `defer` options for optimal performance based on your needs |
117
- | 🔥 **Hot Module Replacement** | Instant feedback during development with tight [Shakapacker](https://github.com/shakacode/shakapacker) integration |
118
- | 📦 **Easy Props Passing** | Direct Rails → React data flow without separate API calls |
119
- | 🗺️ **Router Integration** | [React Router](https://reactrouter.com/) with SSR support |
120
- | 🏪 **State Management** | [Redux](https://redux.js.org/) integration with server-side rendering |
121
- | 🌍 **Internationalization** | [I18n and localization support](https://www.shakacode.com/react-on-rails/docs/guides/i18n) for global apps |
122
- | 🎨 **Modern React** | React 18+ with enhanced React Server Components and latest patterns |
123
- | 🦄 **ReScript Support** | [ReScript integration](https://github.com/shakacode/rescript-react-on-rails-example) for type-safe development |
124
-
125
- > **Trusted by thousands** - See [real production sites](https://publicwww.com/websites/%22react-on-rails%22++-undeveloped.com+depth%3Aall/) using React on Rails
126
-
127
- 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.
128
-
129
- ## Online demo
130
-
131
- - See the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) for an example of a live implementation and code.
132
- - A deployed version of the project `spec/dummy`, which demonstrates several uses of `react_on_rails`, will soon be available on [Control Plane through this link](https://ror-spec-dummy.reactrails.com/)
133
-
134
- ## ShakaCode Forum Premium Content
135
-
136
- _Requires creating a free account._
137
-
138
- - [How to use different versions of a file for client and server rendering](https://forum.shakacode.com/t/how-to-use-different-versions-of-a-file-for-client-and-server-rendering/1352)
139
- - [How to conditionally render server side based on the device type](https://forum.shakacode.com/t/how-to-conditionally-render-server-side-based-on-the-device-type/1473)
140
-
141
- ## Prerequisites
142
-
143
- - Ruby on Rails >= 5
144
- - Shakapacker >= 6.0 (Webpacker is no longer supported as of v16)
145
- - Ruby >= 3.2 (CI tested: 3.2 - 3.4)
146
- - Node.js >= 20 (CI tested: 20 - 22)
147
- - A JavaScript package manager (npm, yarn, pnpm, or bun)
148
-
149
- # 🆘 Get Help & Support
150
-
151
- **Need immediate help?** Here are your options, ordered by response time:
152
-
153
- - 🚀 **Professional Support**: [react_on_rails@shakacode.com](mailto:react_on_rails@shakacode.com) - Fastest resolution for bugs, upgrades, and consulting
154
- - 💬 **React + Rails Slack**: [Join our community](https://invite.reactrails.com) - Chat with other developers
155
- - 🆓 **GitHub Issues**: [Report bugs](https://github.com/shakacode/react_on_rails/issues) - Community support
156
- - 📖 **Discussions**: [Ask questions](https://github.com/shakacode/react_on_rails/discussions) - General help
157
-
158
- **Additional Resources:**
159
-
160
- - [**Subscribe**](https://app.mailerlite.com/webforms/landing/l1d9x5) for announcements of new releases and tutorials
161
- - **[forum.shakacode.com](https://forum.shakacode.com)** - Development discussions
162
- - **[@railsonmaui on Twitter](https://twitter.com/railsonmaui)** - Updates and tips
163
- - [Projects using React on Rails](https://github.com/shakacode/react_on_rails/tree/master/PROJECTS.md) - Submit yours!
164
-
165
- ## Contributing
166
-
167
- Bug reports and pull requests are welcome. To get started, see [Contributing](https://github.com/shakacode/react_on_rails/tree/master/CONTRIBUTING.md) and the [list of help wanted issues](https://github.com/shakacode/react_on_rails/labels/contributions%3A%20up%20for%20grabs%21).
168
-
169
- # Work with Us
170
-
171
- ShakaCode is **[hiring passionate software engineers](http://www.shakacode.com/career)** to work on our projects, including [HiChee](https://hichee.com)!
172
-
173
- # License
174
-
175
- The gem is available as open source under the terms of the [MIT License](https://github.com/shakacode/react_on_rails/tree/master/LICENSE.md).
176
-
177
- Note, some features are available only with a React on Rails Pro subscription. See [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro/) for more information.
178
-
179
- # Supporters
180
-
181
- The following companies support our open-source projects, and ShakaCode uses their products!
182
-
183
- <br />
184
- <br />
185
-
186
- <a href="https://jb.gg/OpenSource" style="margin-right: 20px;">
187
- <img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.png" alt="JetBrains" height="120px">
188
- </a>
189
- <a href="https://scoutapp.com">
190
- <picture>
191
- <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/4244251/184881147-0d077438-3978-40da-ace9-4f650d2efe2e.png">
192
- <source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/4244251/184881152-9f2d8fba-88ac-4ba6-873b-22387f8711c5.png">
193
- <img alt="ScoutAPM" src="https://user-images.githubusercontent.com/4244251/184881152-9f2d8fba-88ac-4ba6-873b-22387f8711c5.png" height="120px">
194
- </picture>
195
- </a>
196
- <a href="https://shakacode.controlplane.com">
197
- <picture>
198
- <img alt="Control Plane" src="https://github.com/shakacode/.github/assets/20628911/90babd87-62c4-4de3-baa4-3d78ef4bec25" height="120px">
199
- </picture>
200
- </a>
201
- <br />
202
- <a href="https://www.browserstack.com">
203
- <picture>
204
- <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/4244251/184881122-407dcc29-df78-4b20-a9ad-f597b56f6cdb.png">
205
- <source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/4244251/184881129-e1edf4b7-3ae1-4ea8-9e6d-3595cf01609e.png">
206
- <img alt="BrowserStack" src="https://user-images.githubusercontent.com/4244251/184881129-e1edf4b7-3ae1-4ea8-9e6d-3595cf01609e.png" height="55px">
207
- </picture>
208
- </a>
209
- <a href="https://railsautoscale.com">
210
- <img src="https://user-images.githubusercontent.com/4244251/184881144-95c2c25c-9879-4069-864d-4e67d6ed39d2.png" alt="Rails Autoscale" height="55px">
211
- </a>
212
- <a href="https://www.honeybadger.io">
213
- <img src="https://user-images.githubusercontent.com/4244251/184881133-79ee9c3c-8165-4852-958e-31687b9536f4.png" alt="Honeybadger" height="55px">
214
- </a>
215
- <a href="https://reviewable.io">
216
- <img src="https://user-images.githubusercontent.com/20628911/230848305-c94510a4-82d7-468f-bf9f-eeb81d3f2ce0.png" alt="Reviewable" height="55px">
217
- </a>
data/SUMMARY.md DELETED
@@ -1,88 +0,0 @@
1
- # Table of Contents
2
-
3
- Documentation for React on Rails has moved!
4
-
5
- Here is the new link:
6
-
7
- **[React on Rails Documentation Link](https://www.shakacode.com/react-on-rails/docs/)**
8
-
9
- ---
10
-
11
- ## **OLD DOCS BELOW**
12
-
13
- - [Home](./README.md)
14
-
15
- ## **Basics**
16
-
17
- - [React on Rails Basic Installation Tutorial](./docs/tutorial.md)
18
- - [Webpack Configuration](./docs/guides/webpack-configuration.md)
19
- - [How React on Rails Works](docs/outdated/how-react-on-rails-works.md)
20
- - [Client vs. Server Rendering](./docs/guides/client-vs-server-rendering.md)
21
- - [React Server Rendering](./docs/guides/react-server-rendering.md)
22
- - [🚀 Next-Gen Server Rendering: Streaming with React 18's Latest APIs](./docs/guides/streaming-server-rendering.md)
23
- - [Render-Functions and the RailsContext](docs/guides/render-functions-and-railscontext.md)
24
- - [Caching and Performance: React on Rails Pro](https://github.com/shakacode/react_on_rails/wiki).
25
- - [Deployment](docs/guides/deployment.md).
26
- - [React on Rails Internationalization (I18n, localization)](docs/guides/i18n.md)
27
- - [RSpec Test Helpers Configuration](docs/guides/rspec-configuration.md)
28
- - [Minitest Configuration](docs/guides/minitest-configuration.md)
29
- - [Upgrading React on Rails](docs/guides/upgrading-react-on-rails.md)
30
-
31
- ## **API**
32
-
33
- - [View Helpers API](./docs/api/view-helpers-api.md)
34
- - [JavaScript API](./docs/api/javascript-api.md)
35
- - [Redux Store API](./docs/api/redux-store-api.md)
36
-
37
- ## **Additional Details**
38
-
39
- - [Migration from `react-rails`](./docs/guides/migrating-from-react-rails.md)
40
- - [Generator Details](docs/guides/generator-details.md)
41
- - [Updating Dependencies](./docs/additional-reading/updating-dependencies.md)
42
- - [Manual Installation Overview](docs/outdated/manual-installation-overview.md)
43
- - [Upgrading from rails/webpacker v3 to v4](docs/additional-reading/upgrade-webpacker-v3-to-v4.md)
44
- - [Recommended Project Structure](docs/additional-reading/recommended-project-structure.md)
45
-
46
- ## **Rails**
47
-
48
- - [Rails Engine Integration](./docs/additional-reading/rails-engine-integration.md)
49
- - [Rails View Rendering from Inline JavaScript](./docs/additional-reading/rails_view_rendering_from_inline_javascript.md)
50
- - [Turbolinks](./docs/additional-reading/turbolinks.md)
51
- - [Converting a Rails 5 API only app to a Rails app](./docs/additional-reading/convert-rails-5-api-only-app.md)
52
-
53
- ## **Javascript**
54
-
55
- - [Node Dependencies, NPM, and Yarn](./docs/additional-reading/node-dependencies-and-npm.md)
56
- - [React Router](./docs/additional-reading/react-router.md)
57
- - [React & Redux](./docs/additional-reading/react-and-redux.md)
58
- - [Webpack Tips](./docs/additional-reading/webpack.md)
59
- - [Server Rendering Tips](./docs/additional-reading/server-rendering-tips.md)
60
- - [Code Splitting](docs/outdated/code-splitting.md)
61
- - [AngularJS Integration and Migration to React on Rails](./docs/additional-reading/angular-js-integration-migration.md)
62
-
63
- ## **Deployment**
64
-
65
- - [Heroku Deployment](docs/guides/heroku-deployment.md)
66
- - [Elastic Beanstalk Deployment](./docs/additional-reading/elastic-beanstalk.md)
67
-
68
- ## Outdated Non-Webpack Docs
69
-
70
- - [Developing with the Webpack Dev Server](./docs/additional-reading/webpack-dev-server.md)
71
- - [Webpack, the Asset Pipeline, and Using Assets w/ React](./docs/outdated/rails-assets-relative-paths.md)
72
-
73
- ## **[CONTRIBUTING](CONTRIBUTING.md)**
74
-
75
- - [Generator Testing](./docs/contributor-info/generator-testing.md)
76
- - [Linting](./docs/contributor-info/linters.md)
77
- - [Releasing](./docs/contributor-info/releasing.md)
78
-
79
- ## **Misc**
80
-
81
- - [Tips](./docs/additional-reading/tips.md)
82
- - [Changelog](./CHANGELOG.md)
83
- - [Projects](./PROJECTS.md)
84
- - [Shaka Code Style](./docs/coding-style/style.md)
85
- - [React on Rails, Slides](http://www.slideshare.net/justingordon/react-on-rails-v61)
86
- - [Code of Conduct](./docs/misc/code_of_conduct.md)
87
- - [The React on Rails Doctrine](https://medium.com/@railsonmaui/the-react-on-rails-doctrine-3c59a778c724)
88
- - [React on Rails, 2000+ 🌟 Stars](https://medium.com/shakacode/react-on-rails-2000-stars-32ff5cfacfbf#.6gmfb2gpy)
data/TODO.md DELETED
@@ -1,135 +0,0 @@
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
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Check for trailing newlines on all changed files
3
- set -euo pipefail
4
-
5
- CONTEXT="${1:-staged}"
6
- files="$(bin/lefthook/get-changed-files "$CONTEXT" '.*')"
7
-
8
- if [ -z "$files" ]; then
9
- echo "✅ No files to check for trailing newlines"
10
- exit 0
11
- fi
12
-
13
- if [ "$CONTEXT" = "all-changed" ]; then
14
- echo "🔍 Checking trailing newlines on all changed files..."
15
- else
16
- echo "🔍 Checking trailing newlines on $CONTEXT files..."
17
- fi
18
-
19
- failed_files=""
20
- for file in $files; do
21
- if [ -f "$file" ] && [ -s "$file" ]; then
22
- if ! tail -c 1 "$file" | grep -q '^$'; then
23
- echo "❌ Missing trailing newline: $file"
24
- failed_files="$failed_files $file"
25
- fi
26
- fi
27
- done
28
-
29
- if [ -n "$failed_files" ]; then
30
- echo ""
31
- echo "❌ Trailing newline check failed!"
32
- echo "💡 Add trailing newlines to:$failed_files"
33
- echo "🔧 Quick fix: for file in$failed_files; do echo >> \"\$file\"; done"
34
- echo "🚫 Skip hook: git commit --no-verify"
35
- exit 1
36
- fi
37
-
38
- echo "✅ All files have proper trailing newlines"
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Get changed files based on context (staged, branch, or all)
3
- set -euo pipefail
4
-
5
- CONTEXT="${1:-staged}"
6
- PATTERN="${2:-.*}"
7
-
8
- case "$CONTEXT" in
9
- staged)
10
- git diff --cached --name-only --diff-filter=ACM | grep -E "$PATTERN" || true
11
- ;;
12
- all-changed)
13
- # Get all changed files (staged + unstaged + untracked) vs working directory
14
- (git diff --cached --name-only --diff-filter=ACM; git diff --name-only --diff-filter=ACM; git ls-files --others --exclude-standard) | sort -u | grep -E "$PATTERN" || true
15
- ;;
16
- branch)
17
- # Find base branch (prefer main over master)
18
- base="origin/main"
19
- git rev-parse --verify --quiet "$base" >/dev/null || base="origin/master"
20
- git diff --name-only --diff-filter=ACM "$base"...HEAD | grep -E "$PATTERN" || true
21
- ;;
22
- *)
23
- echo "Usage: $0 {staged|all-changed|branch} [pattern]" >&2
24
- exit 1
25
- ;;
26
- esac
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Format JS/TS/JSON/MD files with Prettier
3
- set -euo pipefail
4
-
5
- CONTEXT="${1:-staged}"
6
- files="$(bin/lefthook/get-changed-files "$CONTEXT" '\.(js|jsx|ts|tsx|json|md|yml|yaml)$')"
7
-
8
- if [ -z "$files" ]; then
9
- echo "✅ No files to format with Prettier"
10
- exit 0
11
- fi
12
-
13
- if [ "$CONTEXT" = "all-changed" ]; then
14
- echo "💅 Prettier on all changed files:"
15
- else
16
- echo "💅 Prettier on $CONTEXT files:"
17
- fi
18
- printf " %s\n" $files
19
-
20
- yarn run prettier --write $files
21
-
22
- # Re-stage files if running on staged or all-changed context
23
- if [ "$CONTEXT" = "staged" ] || [ "$CONTEXT" = "all-changed" ]; then
24
- echo $files | xargs -r git add
25
- echo "✅ Re-staged formatted files"
26
- fi
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Auto-fix Ruby files using rake autofix
3
- set -euo pipefail
4
-
5
- CONTEXT="${1:-staged}"
6
- files="$(bin/lefthook/get-changed-files "$CONTEXT" '\.(rb|rake|ru)$')"
7
-
8
- if [ -z "$files" ]; then
9
- echo "✅ No Ruby files to autofix"
10
- exit 0
11
- fi
12
-
13
- if [ "$CONTEXT" = "all-changed" ]; then
14
- echo "🎨 Autofix on all changed Ruby files:"
15
- else
16
- echo "🎨 Autofix on $CONTEXT Ruby files:"
17
- fi
18
- printf " %s\n" $files
19
-
20
- bundle exec rake autofix
21
-
22
- # Re-stage files if running on staged or all-changed context
23
- if [ "$CONTEXT" = "staged" ] || [ "$CONTEXT" = "all-changed" ]; then
24
- echo $files | xargs -r git add
25
- echo "✅ Re-staged formatted files"
26
- fi
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Lint Ruby files with RuboCop
3
- set -euo pipefail
4
-
5
- CONTEXT="${1:-staged}"
6
- files="$(bin/lefthook/get-changed-files "$CONTEXT" '\.(rb|rake|ru)$')"
7
-
8
- if [ -z "$files" ]; then
9
- echo "✅ No Ruby files to lint"
10
- exit 0
11
- fi
12
-
13
- if [ "$CONTEXT" = "all-changed" ]; then
14
- echo "🔍 RuboCop on all changed Ruby files:"
15
- else
16
- echo "🔍 RuboCop on $CONTEXT Ruby files:"
17
- fi
18
- printf " %s\n" $files
19
-
20
- if ! bundle exec rubocop --force-exclusion --display-cop-names -- $files; then
21
- echo ""
22
- echo "❌ RuboCop check failed!"
23
- echo "💡 Auto-fix: bundle exec rubocop --auto-correct --force-exclusion -- $files"
24
- echo "🚫 Skip hook: git commit --no-verify"
25
- exit 1
26
- fi
27
- echo "✅ RuboCop checks passed for Ruby files"
data/docker-compose.yml DELETED
@@ -1,11 +0,0 @@
1
- lint:
2
- image: dylangrafmyre/docker-lint:latest
3
- working_dir: /app/
4
- volumes:
5
- - '.:/app/'
6
- tests:
7
- build: .
8
- dockerfile: Dockerfile_tests
9
- working_dir: /app/
10
- volumes:
11
- - '.:/app/'