Skip to content

Commit 81c4cfb

Browse files
justin808claude
andcommitted
fix: Check Shakapacker status before installation, remove files after
Move the Shakapacker pre-configuration check to BEFORE invoking generators, but keep the file removal logic BEFORE generators run. The correct sequence is now: 1. Check if Shakapacker is configured (save as boolean) 2. If pre-configured, remove default conflicting files 3. Invoke generators (which may install Shakapacker) 4. Continue installation This prevents removing files we create ourselves while still removing conflicting default files when Shakapacker was installed beforehand. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3e4b5a6 commit 81c4cfb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/generators/react_on_rails/install_generator.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,14 @@ class InstallGenerator < Rails::Generators::Base
3838

3939
def run_generators
4040
if installation_prerequisites_met? || options.ignore_warnings?
41-
# Only remove default files if Shakapacker is already configured
42-
# If it's not configured, we'll install it ourselves and shouldn't delete what we create
43-
remove_default_gem_files if shakapacker_configured?
41+
# Check if Shakapacker is configured BEFORE we run any generators
42+
# This way we know if it existed before React on Rails installation
43+
shakapacker_was_preconfigured = shakapacker_configured?
44+
45+
# Only remove default files if Shakapacker was already configured before we started
46+
# If it wasn't configured, we'll install it ourselves and shouldn't delete those files
47+
remove_default_gem_files if shakapacker_was_preconfigured
48+
4449
invoke_generators
4550
add_bin_scripts
4651
# Only add the post install message if not using Redux

0 commit comments

Comments
 (0)