diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 294f2dab70..36355f6df3 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -130,7 +130,9 @@ jobs: yarn install --no-progress --no-emoji ${{ matrix.dependency-level == 'latest' && '--frozen-lockfile' || '' }} sudo yarn global add yalc - name: yalc publish for react-on-rails - run: yalc publish + # Use yarn workspace script to publish all workspace packages to yalc + # Runs the "yalc:publish" script defined in each workspace's package.json + run: yarn yalc publish - name: Install Ruby Gems for package run: | bundle lock --add-platform 'x86_64-linux' diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dc964af1d..704408d359 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,16 @@ After a release, please make sure to run `bundle exec rake update_changelog`. Th Changes since the last non-beta release. +#### Changed + +- **Generator Configuration Modernization**: Updated the generator to enable recommended configurations by default for new applications: + + - `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 + - `config.auto_load_bundle = true` is now set by default, enabling automatic loading of component bundles + - `config.components_subdirectory = "ror_components"` is now set by default, organizing React components in a dedicated subdirectory + + **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). + ### [16.2.0.beta.4] - 2025-11-12 #### Added diff --git a/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt b/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt index 8015f38971..e063171d21 100644 --- a/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt +++ b/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt @@ -26,8 +26,10 @@ ReactOnRails.configure do |config| # - Requires adding ReactOnRails::TestHelper to spec/rails_helper.rb # - See: https://github.com/shakacode/react_on_rails/blob/master/docs/guides/testing-configuration.md # - # config.build_test_command = "RAILS_ENV=test bin/shakapacker" + config.build_test_command = "RAILS_ENV=test bin/shakapacker" + config.auto_load_bundle = true + config.components_subdirectory = "ror_components" ################################################################################ # Advanced Configuration ################################################################################ diff --git a/rakelib/shakapacker_examples.rake b/rakelib/shakapacker_examples.rake index 165bbfc0d2..5f5f1bb864 100644 --- a/rakelib/shakapacker_examples.rake +++ b/rakelib/shakapacker_examples.rake @@ -36,8 +36,20 @@ namespace :shakapacker_examples do # rubocop:disable Metrics/BlockLength sh_in_dir(example_type.dir, "echo \"gem 'shakapacker', '>= 8.2.0'\" >> #{example_type.gemfile}") bundle_install_in(example_type.dir) sh_in_dir(example_type.dir, "rake shakapacker:install") - sh_in_dir(example_type.dir, example_type.generator_shell_commands) + # Skip validation when running generators on example apps during development. + # The generator validates that certain config options exist in the initializer, + # but during example generation, we're often testing against the current gem + # codebase which may have new config options not yet in the released version. + # This allows examples to be generated without validation errors while still + # testing the generator functionality. + generator_commands = example_type.generator_shell_commands.map do |cmd| + "REACT_ON_RAILS_SKIP_VALIDATION=true #{cmd}" + end + sh_in_dir(example_type.dir, generator_commands) sh_in_dir(example_type.dir, "npm install") + # Generate the component packs after running the generator to ensure all + # auto-bundled components have corresponding pack files created + sh_in_dir(example_type.dir, "bundle exec rake react_on_rails:generate_packs") end end