Skip to content

Commit 6da1351

Browse files
justin808claude
andcommitted
Restore Rainbow colors and SKIP_VALIDATION to generator template
Restored the original implementation which had: 1. Rainbow colored output for better UX during builds 2. ENV["REACT_ON_RAILS_SKIP_VALIDATION"] = "true" because this hook loads Rails environment and validation would fail during builds The SKIP_VALIDATION is needed here because: - The hook loads Rails via require_relative "../config/environment" - This triggers the engine's validation initializer - During precompile, packages may not be fully available yet - Setting this env var prevents spurious validation failures 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 5682b3d commit 6da1351

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/generators/react_on_rails/templates/base/base/bin/shakapacker-precompile-hook

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,23 @@
88
# when configured in config/shakapacker.yml:
99
# precompile_hook: 'bin/shakapacker-precompile-hook'
1010
#
11-
# See: https://github.com/shakacode/shakapacker/blob/main/docs/precompile_hook.md
11+
# Emoji Scheme:
12+
# 🔄 = Running/in-progress
13+
# ✅ = Success
14+
# ❌ = Error
15+
16+
# Skip validation during precompile hook execution
17+
# The hook runs early in the build process, potentially before full Rails initialization,
18+
# and doesn't need package version validation since it's part of the build itself
19+
ENV["REACT_ON_RAILS_SKIP_VALIDATION"] = "true"
1220

1321
require_relative "../config/environment"
1422

1523
begin
24+
puts Rainbow("🔄 Running React on Rails precompile hook...").cyan
1625
ReactOnRails::PacksGenerator.instance.generate_packs_if_stale
1726
rescue StandardError => e
18-
warn "❌ Error in precompile hook: #{e.message}"
27+
warn Rainbow("❌ Error in precompile hook: #{e.message}").red
1928
warn e.backtrace.first(5).join("\n")
2029
exit 1
2130
end

0 commit comments

Comments
 (0)