react_on_rails 14.2.1 → 16.1.1

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 (116) hide show
  1. checksums.yaml +4 -4
  2. data/AI_AGENT_INSTRUCTIONS.md +63 -0
  3. data/CHANGELOG.md +564 -85
  4. data/CLAUDE.md +135 -0
  5. data/CODING_AGENTS.md +313 -0
  6. data/CONTRIBUTING.md +448 -37
  7. data/Gemfile.development_dependencies +6 -1
  8. data/Gemfile.lock +13 -4
  9. data/KUDOS.md +22 -1
  10. data/LICENSE.md +30 -4
  11. data/LICENSES/README.md +14 -0
  12. data/NEWS.md +48 -48
  13. data/PROJECTS.md +45 -40
  14. data/REACT-ON-RAILS-PRO-LICENSE.md +129 -0
  15. data/README.md +113 -42
  16. data/SUMMARY.md +62 -52
  17. data/TODO.md +135 -0
  18. data/bin/lefthook/check-trailing-newlines +38 -0
  19. data/bin/lefthook/get-changed-files +26 -0
  20. data/bin/lefthook/prettier-format +26 -0
  21. data/bin/lefthook/ruby-autofix +26 -0
  22. data/bin/lefthook/ruby-lint +27 -0
  23. data/eslint.config.ts +232 -0
  24. data/knip.ts +40 -6
  25. data/lib/generators/USAGE +4 -5
  26. data/lib/generators/react_on_rails/USAGE +65 -0
  27. data/lib/generators/react_on_rails/base_generator.rb +276 -62
  28. data/lib/generators/react_on_rails/dev_tests_generator.rb +1 -0
  29. data/lib/generators/react_on_rails/generator_helper.rb +35 -1
  30. data/lib/generators/react_on_rails/generator_messages.rb +138 -17
  31. data/lib/generators/react_on_rails/install_generator.rb +474 -26
  32. data/lib/generators/react_on_rails/react_no_redux_generator.rb +19 -6
  33. data/lib/generators/react_on_rails/react_with_redux_generator.rb +110 -18
  34. data/lib/generators/react_on_rails/templates/.eslintrc +1 -1
  35. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev +5 -0
  36. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-prod-assets +8 -0
  37. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-static-assets +2 -0
  38. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +0 -5
  39. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.module.css +2 -2
  40. data/lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorldServer.js +1 -1
  41. data/lib/generators/react_on_rails/templates/base/base/app/javascript/packs/server-bundle.js +1 -8
  42. data/lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx +21 -0
  43. data/lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.tsx +25 -0
  44. data/lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.module.css +4 -0
  45. data/lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.server.jsx +5 -0
  46. data/lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.server.tsx +5 -0
  47. data/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt +1 -1
  48. data/lib/generators/react_on_rails/templates/base/base/app/views/layouts/hello_world.html.erb +4 -2
  49. data/lib/generators/react_on_rails/templates/base/base/babel.config.js.tt +5 -2
  50. data/lib/generators/react_on_rails/templates/base/base/bin/dev +34 -0
  51. data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt +14 -5
  52. data/lib/generators/react_on_rails/templates/base/base/config/shakapacker.yml +76 -7
  53. data/lib/generators/react_on_rails/templates/base/base/config/webpack/commonWebpackConfig.js.tt +1 -1
  54. data/lib/generators/react_on_rails/templates/base/base/config/webpack/development.js.tt +6 -10
  55. data/lib/generators/react_on_rails/templates/base/base/config/webpack/production.js.tt +2 -2
  56. data/lib/generators/react_on_rails/templates/base/base/config/webpack/serverWebpackConfig.js.tt +3 -2
  57. data/lib/generators/react_on_rails/templates/base/base/config/webpack/test.js.tt +2 -2
  58. data/lib/generators/react_on_rails/templates/dev_tests/spec/system/hello_world_spec.rb +0 -2
  59. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/actions/helloWorldActionCreators.ts +18 -0
  60. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx +0 -6
  61. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.module.css +4 -0
  62. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.tsx +24 -0
  63. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/constants/helloWorldConstants.ts +6 -0
  64. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/containers/HelloWorldContainer.ts +20 -0
  65. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/reducers/helloWorldReducer.js +1 -1
  66. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/reducers/helloWorldReducer.ts +22 -0
  67. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/startup/HelloWorldApp.client.tsx +23 -0
  68. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/startup/HelloWorldApp.server.jsx +5 -0
  69. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/startup/HelloWorldApp.server.tsx +5 -0
  70. data/lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/store/helloWorldStore.ts +18 -0
  71. data/lib/react_on_rails/configuration.rb +141 -57
  72. data/lib/react_on_rails/controller.rb +6 -2
  73. data/lib/react_on_rails/dev/file_manager.rb +78 -0
  74. data/lib/react_on_rails/dev/pack_generator.rb +27 -0
  75. data/lib/react_on_rails/dev/process_manager.rb +61 -0
  76. data/lib/react_on_rails/dev/server_manager.rb +487 -0
  77. data/lib/react_on_rails/dev.rb +20 -0
  78. data/lib/react_on_rails/doctor.rb +1149 -0
  79. data/lib/react_on_rails/engine.rb +6 -0
  80. data/lib/react_on_rails/git_utils.rb +12 -2
  81. data/lib/react_on_rails/helper.rb +176 -74
  82. data/lib/react_on_rails/json_parse_error.rb +6 -1
  83. data/lib/react_on_rails/packer_utils.rb +61 -71
  84. data/lib/react_on_rails/packs_generator.rb +221 -19
  85. data/lib/react_on_rails/prerender_error.rb +4 -0
  86. data/lib/react_on_rails/pro/NOTICE +21 -0
  87. data/lib/react_on_rails/pro/helper.rb +122 -0
  88. data/lib/react_on_rails/pro/utils.rb +53 -0
  89. data/lib/react_on_rails/react_component/render_options.rb +38 -6
  90. data/lib/react_on_rails/server_rendering_js_code.rb +0 -1
  91. data/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +12 -5
  92. data/lib/react_on_rails/system_checker.rb +659 -0
  93. data/lib/react_on_rails/test_helper/webpack_assets_compiler.rb +1 -1
  94. data/lib/react_on_rails/test_helper/webpack_assets_status_checker.rb +6 -4
  95. data/lib/react_on_rails/test_helper.rb +2 -3
  96. data/lib/react_on_rails/utils.rb +139 -43
  97. data/lib/react_on_rails/version.rb +1 -1
  98. data/lib/react_on_rails/version_checker.rb +14 -20
  99. data/lib/react_on_rails/version_syntax_converter.rb +1 -1
  100. data/lib/react_on_rails.rb +1 -0
  101. data/lib/tasks/assets.rake +1 -1
  102. data/lib/tasks/doctor.rake +48 -0
  103. data/lib/tasks/generate_packs.rake +158 -1
  104. data/react_on_rails.gemspec +1 -0
  105. data/tsconfig.eslint.json +6 -0
  106. data/tsconfig.json +5 -3
  107. metadata +63 -14
  108. data/REACT-ON-RAILS-PRO-LICENSE +0 -95
  109. data/lib/generators/react_on_rails/adapt_for_older_shakapacker_generator.rb +0 -41
  110. data/lib/generators/react_on_rails/bin/dev +0 -30
  111. data/lib/generators/react_on_rails/bin/dev-static +0 -30
  112. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev-static.tt +0 -9
  113. data/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt +0 -5
  114. data/lib/generators/react_on_rails/templates/base/base/app/javascript/packs/registration.js.tt +0 -8
  115. /data/lib/generators/react_on_rails/templates/base/base/config/webpack/{webpackConfig.js.tt → generateWebpackConfigs.js.tt} +0 -0
  116. /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,29 +9,39 @@
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)
16
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
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
18
 
19
- # News
20
- * [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.
21
- * ShakaCode now maintains the official successor to `rails/webpacker`, [`shakapacker`](https://github.com/shakacode/shakapacker).
22
- * Project is updated to support Rails 7 and Shakapacker v6+!
19
+ # ⚡ What's New
23
20
 
24
- -----
21
+ **🚀 React on Rails v16.0 Released!** Major modernization with ESM support, enhanced React Server Components, and streamlined configuration.
25
22
 
26
- *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).*
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).
27
29
 
28
- # About
29
- React on Rails integrates Rails with (server rendering of) [React](https://github.com/facebook/react).
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.
30
37
 
31
- This project is maintained by [ShakaCode](https://www.shakacode.com).
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.
32
41
 
33
42
  ## ShakaCode Upgrade Support
34
- 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.
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.
35
45
 
36
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/).
37
47
 
@@ -39,72 +49,133 @@ We also specialize in helping development teams lower infrastructure and CI cost
39
49
 
40
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.
41
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
+
42
79
  ## React on Rails Pro
43
- Are you interested in optimizing your webpack setup for React on Rails, including code splitting with [react-router](https://github.com/ReactTraining/react-router#readme) and [loadable-components](https://loadable-components.com/) with server-side rendering for SEO and hot-reloading for developers?
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
+
44
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.
45
95
 
46
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).
47
97
 
48
- # Documentation
98
+ # 📚 Quick Start
99
+
100
+ **New to React on Rails?** Get up and running in minutes:
49
101
 
50
- See the documentation at **[shakacode.com/react-on-rails/docs](https://www.shakacode.com/react-on-rails/docs/)**.
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)
51
105
 
52
106
  ## Project Objective
53
107
 
54
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.
55
109
 
56
- ## Features and Why React on Rails?
110
+ ## Why React on Rails?
57
111
 
58
- Given that `shakacode/shakapacker` gem already provides basic React integration, why would you use "React on Rails"?
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 |
59
124
 
60
- 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.
61
- 1. Keep up with the latest changes in different versions of React. React 18 is supported.
62
- 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.
63
- Tight integration with [shakapacker](https://github.com/shakacode/shakapacker) (or its predecessor [rails/webpacker](https://github.com/rails/webpacker)).
64
- 1. Server-Side Rendering (SSR), often used for SEO crawler indexing and UX performance.
65
- 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/)
66
- 1. [Redux](https://github.com/reactjs/redux) and [React Router](https://github.com/ReactTraining/react-router#readme) integration with server-side-rendering.
67
- 1. [Internationalization (I18n) and (localization)](https://www.shakacode.com/react-on-rails/docs/guides/i18n)
68
- 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/).
69
- 1. [ReScript Support](https://github.com/shakacode/rescript-react-on-rails-example).
125
+ > **Trusted by thousands** - See [real production sites](https://publicwww.com/websites/%22react-on-rails%22++-undeveloped.com+depth%3Aall/) using React on Rails
70
126
 
71
- 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.
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.
72
128
 
73
129
  ## Online demo
74
- * See the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) for an example of a live implementation and code.
75
- * 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/)
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/)
76
133
 
77
134
  ## ShakaCode Forum Premium Content
135
+
78
136
  _Requires creating a free account._
79
137
 
80
- * [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)
81
- * [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)
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)
82
140
 
83
141
  ## Prerequisites
84
142
 
85
- Ruby on Rails >=5, rails/webpacker >= 4.2 or shakapacker > 6, Ruby >= 3.0.0
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:
86
152
 
87
- # Support
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
88
157
 
89
- * [Click to join **React + Rails Slack**](https://reactrails.slack.com/join/shared_invite/enQtNjY3NTczMjczNzYxLTlmYjdiZmY3MTVlMzU2YWE0OWM0MzNiZDI0MzdkZGFiZTFkYTFkOGVjODBmOWEyYWQ3MzA2NGE1YWJjNmVlMGE).
90
- - [**Subscribe**](https://app.mailerlite.com/webforms/landing/l1d9x5) for announcements of new releases of React on Rails and of our latest [blog articles](https://blog.shakacode.com) and tutorials.
91
- - [Discussions](https://github.com/shakacode/react_on_rails/discussions): Post your questions regarding React on Rails
92
- - **[forum.shakacode.com](https://forum.shakacode.com)**: Other discussions
93
- - **[@railsonmaui on Twitter](https://twitter.com/railsonmaui)**
94
- - *See [NEWS.md](https://github.com/shakacode/react_on_rails/tree/master/NEWS.md) for more notes over time.*
95
- - See [Projects](https://github.com/shakacode/react_on_rails/tree/master/PROJECTS.md) using and [KUDOS](https://github.com/shakacode/react_on_rails/tree/master/KUDOS.md) for React on Rails. Please submit yours! Please edit either page or [email us](mailto:contact@shakacode.com) and we'll add your info. We also **love stars** as it helps us attract new users and contributors.
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!
96
164
 
97
165
  ## Contributing
98
166
 
99
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).
100
168
 
101
169
  # Work with Us
170
+
102
171
  ShakaCode is **[hiring passionate software engineers](http://www.shakacode.com/career)** to work on our projects, including [HiChee](https://hichee.com)!
103
172
 
104
173
  # License
105
174
 
106
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).
107
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
+
108
179
  # Supporters
109
180
 
110
181
  The following companies support our open-source projects, and ShakaCode uses their products!
@@ -112,8 +183,8 @@ The following companies support our open-source projects, and ShakaCode uses the
112
183
  <br />
113
184
  <br />
114
185
 
115
- <a href="https://www.jetbrains.com">
116
- <img src="https://user-images.githubusercontent.com/4244251/184881139-42e4076b-024b-4b30-8c60-c3cd0e758c0a.png" alt="JetBrains" height="120px">
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">
117
188
  </a>
118
189
  <a href="https://scoutapp.com">
119
190
  <picture>
data/SUMMARY.md CHANGED
@@ -6,73 +6,83 @@ Here is the new link:
6
6
 
7
7
  **[React on Rails Documentation Link](https://www.shakacode.com/react-on-rails/docs/)**
8
8
 
9
- -----
9
+ ---
10
10
 
11
11
  ## **OLD DOCS BELOW**
12
- + [Home](./README.md)
12
+
13
+ - [Home](./README.md)
13
14
 
14
15
  ## **Basics**
15
- + [React on Rails Basic Installation Tutorial](./docs/tutorial.md)
16
- + [Webpack Configuration](./docs/guides/webpack-configuration.md)
17
- + [How React on Rails Works](docs/outdated/how-react-on-rails-works.md)
18
- + [Client vs. Server Rendering](./docs/guides/client-vs-server-rendering.md)
19
- + [React Server Rendering](./docs/guides/react-server-rendering.md)
20
- + [🚀 Next-Gen Server Rendering: Streaming with React 18's Latest APIs](./docs/guides/streaming-server-rendering.md)
21
- + [Render-Functions and the RailsContext](docs/guides/render-functions-and-railscontext.md)
22
- + [Caching and Performance: React on Rails Pro](https://github.com/shakacode/react_on_rails/wiki).
23
- + [Deployment](docs/guides/deployment.md).
24
- + [React on Rails Internationalization (I18n, localization)](docs/guides/i18n.md)
25
- + [RSpec Test Helpers Configuration](docs/guides/rspec-configuration.md)
26
- + [Minitest Configuration](docs/guides/minitest-configuration.md)
27
- + [Upgrading React on Rails](docs/guides/upgrading-react-on-rails.md)
28
-
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
+
29
31
  ## **API**
30
- - [View Helpers API](./docs/api/view-helpers-api.md)
31
- - [JavaScript API](./docs/api/javascript-api.md)
32
- - [Redux Store API](./docs/api/redux-store-api.md)
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)
33
36
 
34
37
  ## **Additional Details**
35
- + [Migration from react-rails](./docs/guides/migrating-from-react-rails.md)
36
- + [Generator Details](docs/guides/generator-details.md)
37
- + [Updating Dependencies](./docs/additional-reading/updating-dependencies.md)
38
- + [Manual Installation Overview](docs/outdated/manual-installation-overview.md)
39
- + [Upgrading from rails/webpacker v3 to v4](docs/additional-reading/upgrade-webpacker-v3-to-v4.md)
40
- + [Recommended Project Structure](docs/additional-reading/recommended-project-structure.md)
41
-
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
+
42
46
  ## **Rails**
43
- + [Rails Engine Integration](./docs/additional-reading/rails-engine-integration.md)
44
- + [Rails View Rendering from Inline JavaScript](./docs/additional-reading/rails_view_rendering_from_inline_javascript.md)
45
- + [Turbolinks](./docs/additional-reading/turbolinks.md)
46
- + [Converting a Rails 5 API only app to a Rails app](./docs/additional-reading/convert-rails-5-api-only-app.md)
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)
47
52
 
48
53
  ## **Javascript**
49
- + [Node Dependencies, NPM, and Yarn](./docs/additional-reading/node-dependencies-and-npm.md)
50
- + [React Router](./docs/additional-reading/react-router.md)
51
- + [React & Redux](./docs/additional-reading/react-and-redux.md)
52
- + [Webpack Tips](./docs/additional-reading/webpack.md)
53
- + [Server Rendering Tips](./docs/additional-reading/server-rendering-tips.md)
54
- + [Code Splitting](docs/outdated/code-splitting.md)
55
- + [AngularJS Integration and Migration to React on Rails](./docs/additional-reading/angular-js-integration-migration.md)
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)
56
62
 
57
63
  ## **Deployment**
58
- + [Heroku Deployment](docs/guides/heroku-deployment.md)
59
- + [Elastic Beanstalk Deployment](./docs/additional-reading/elastic-beanstalk.md)
64
+
65
+ - [Heroku Deployment](docs/guides/heroku-deployment.md)
66
+ - [Elastic Beanstalk Deployment](./docs/additional-reading/elastic-beanstalk.md)
60
67
 
61
68
  ## Outdated Non-Webpack Docs
62
- + [Developing with the Webpack Dev Server](./docs/additional-reading/webpack-dev-server.md)
63
- + [Webpack, the Asset Pipeline, and Using Assets w/ React](./docs/outdated/rails-assets-relative-paths.md)
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)
64
72
 
65
73
  ## **[CONTRIBUTING](CONTRIBUTING.md)**
66
- + [Generator Testing](./docs/contributor-info/generator-testing.md)
67
- + [Linting](./docs/contributor-info/linters.md)
68
- + [Releasing](./docs/contributor-info/releasing.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)
69
78
 
70
79
  ## **Misc**
71
- + [Tips](./docs/additional-reading/tips.md)
72
- + [Changelog](./CHANGELOG.md)
73
- + [Projects](./PROJECTS.md)
74
- + [Shaka Code Style](./docs/coding-style/style.md)
75
- + [React on Rails, Slides](http://www.slideshare.net/justingordon/react-on-rails-v61)
76
- + [Code of Conduct](./docs/misc/code_of_conduct.md)
77
- + [The React on Rails Doctrine](https://medium.com/@railsonmaui/the-react-on-rails-doctrine-3c59a778c724)
78
- + [React on Rails, 2000+ 🌟 Stars](https://medium.com/shakacode/react-on-rails-2000-stars-32ff5cfacfbf#.6gmfb2gpy)
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 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
@@ -0,0 +1,38 @@
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"
@@ -0,0 +1,26 @@
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
@@ -0,0 +1,26 @@
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
@@ -0,0 +1,26 @@
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