Skip to content

Commit 240012f

Browse files
justin808claude
andauthored
Apply PR 2039 changes: modernize generator config and workflow (#2040)
## Summary Applies key changes from PR 2039 to modernize generator configuration and workflow updates: - **examples.yml:133** - Changed `yalc publish` to `yarn yalc publish` for consistency - **react_on_rails.rb.tt** - Enabled `build_test_command`, `auto_load_bundle`, and `components_subdirectory` config options - **shakapacker_examples.rake** - Added `REACT_ON_RAILS_SKIP_VALIDATION` wrapper for generator commands and `generate_packs` step These changes align with the modernization efforts to improve generator reliability and configuration defaults. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2f751d1 commit 240012f

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

.github/workflows/examples.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ jobs:
130130
yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }}
131131
sudo yarn global add yalc
132132
- name: yalc publish for react-on-rails
133-
run: yalc publish
133+
# Use yarn workspace script to publish all workspace packages to yalc
134+
# Runs the "yalc:publish" script defined in each workspace's package.json
135+
run: yarn yalc publish
134136
- name: Install Ruby Gems for package
135137
run: |
136138
bundle lock --add-platform 'x86_64-linux'

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ After a release, please make sure to run `bundle exec rake update_changelog`. Th
2323

2424
Changes since the last non-beta release.
2525

26+
#### Changed
27+
28+
- **Generator Configuration Modernization**: Updated the generator to enable recommended configurations by default for new applications:
29+
30+
- `config.build_test_command` is now uncommented and set to `"RAILS_ENV=test bin/shakapacker"` by default, enabling automatic asset building during tests for better integration test reliability
31+
- `config.auto_load_bundle = true` is now set by default, enabling automatic loading of component bundles
32+
- `config.components_subdirectory = "ror_components"` is now set by default, organizing React components in a dedicated subdirectory
33+
34+
**Note:** These changes only affect newly generated applications. Existing applications are unaffected and do not need to make any changes. If you want to adopt these settings in an existing app, you can manually add them to your `config/initializers/react_on_rails.rb` file. [PR 2039](https://github.com/shakacode/react_on_rails/pull/2039) by [justin808](https://github.com/justin808).
35+
2636
### [16.2.0.beta.4] - 2025-11-12
2737

2838
#### Added

lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ ReactOnRails.configure do |config|
2626
# - Requires adding ReactOnRails::TestHelper to spec/rails_helper.rb
2727
# - See: https://github.com/shakacode/react_on_rails/blob/master/docs/guides/testing-configuration.md
2828
#
29-
# config.build_test_command = "RAILS_ENV=test bin/shakapacker"
29+
config.build_test_command = "RAILS_ENV=test bin/shakapacker"
3030

31+
config.auto_load_bundle = true
32+
config.components_subdirectory = "ror_components"
3133
################################################################################
3234
# Advanced Configuration
3335
################################################################################

rakelib/shakapacker_examples.rake

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,20 @@ namespace :shakapacker_examples do # rubocop:disable Metrics/BlockLength
3636
sh_in_dir(example_type.dir, "echo \"gem 'shakapacker', '>= 8.2.0'\" >> #{example_type.gemfile}")
3737
bundle_install_in(example_type.dir)
3838
sh_in_dir(example_type.dir, "rake shakapacker:install")
39-
sh_in_dir(example_type.dir, example_type.generator_shell_commands)
39+
# Skip validation when running generators on example apps during development.
40+
# The generator validates that certain config options exist in the initializer,
41+
# but during example generation, we're often testing against the current gem
42+
# codebase which may have new config options not yet in the released version.
43+
# This allows examples to be generated without validation errors while still
44+
# testing the generator functionality.
45+
generator_commands = example_type.generator_shell_commands.map do |cmd|
46+
"REACT_ON_RAILS_SKIP_VALIDATION=true #{cmd}"
47+
end
48+
sh_in_dir(example_type.dir, generator_commands)
4049
sh_in_dir(example_type.dir, "npm install")
50+
# Generate the component packs after running the generator to ensure all
51+
# auto-bundled components have corresponding pack files created
52+
sh_in_dir(example_type.dir, "bundle exec rake react_on_rails:generate_packs")
4153
end
4254
end
4355

0 commit comments

Comments
 (0)