Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/react_on_rails/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ module ReactOnRails
class Engine < ::Rails::Engine
# Validate package versions and compatibility on Rails startup
# This ensures the application fails fast if versions don't match or packages are misconfigured
# Skip validation during installation tasks (e.g., shakapacker:install)
initializer "react_on_rails.validate_version_and_package_compatibility" do
config.after_initialize do
# Skip validation if package.json doesn't exist yet (during initial setup)
package_json = VersionChecker::NodePackageVersion.package_json_path
next unless File.exist?(package_json)

Rails.logger.info "[React on Rails] Validating package version and compatibility..."
VersionChecker.build.validate_version_and_package_compatibility!
Rails.logger.info "[React on Rails] Package validation successful"
Expand Down
Loading