Skip to content

Commit 50f012d

Browse files
justin808claude
andcommitted
Improve Shakapacker auto-installation with better messaging and options
- Add clearer messaging explaining why Shakapacker is being installed - Add --skip-shakapacker-install option for teams with strict dependency policies - Keep auto-install as default for better user experience - Explain that React on Rails requires Shakapacker for webpack integration This balances ease-of-use for new users with flexibility for advanced users who prefer to manage their own dependencies. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent acf2b26 commit 50f012d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/generators/react_on_rails/install_generator.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,17 @@ class InstallGenerator < Rails::Generators::Base
2525
default: false,
2626
desc: "Skip warnings. Default: false"
2727

28+
# --skip-shakapacker-install
29+
class_option :skip_shakapacker_install,
30+
type: :boolean,
31+
default: false,
32+
desc: "Skip automatic Shakapacker installation. Default: false"
33+
2834
def run_generators
2935
if installation_prerequisites_met? || options.ignore_warnings?
30-
return unless ensure_shakapacker_installed
36+
unless options.skip_shakapacker_install?
37+
return unless ensure_shakapacker_installed
38+
end
3139

3240
invoke_generators
3341
add_bin_scripts
@@ -94,7 +102,11 @@ def add_post_install_message
94102
def ensure_shakapacker_installed
95103
return true if shakapacker_installed?
96104

97-
GeneratorMessages.add_info("Shakapacker not detected. Installing Shakapacker...")
105+
GeneratorMessages.add_info(<<~MSG.strip)
106+
Shakapacker gem not found in your Gemfile.
107+
React on Rails requires Shakapacker for webpack integration.
108+
Adding 'shakapacker' gem to your Gemfile and running installation...
109+
MSG
98110

99111
added = system("bundle", "add", "shakapacker")
100112
unless added

0 commit comments

Comments
 (0)