Skip to content

Commit

Permalink
feat: add railtie initializer to check package manager version
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Mar 26, 2024
1 parent 05bb5d9 commit d6694e2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/shakapacker/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require "shakapacker/helper"
require "shakapacker/dev_server_proxy"
require "shakapacker/version_checker"
require "shakapacker/utils/manager"

class Shakapacker::Engine < ::Rails::Engine
# Allows Shakapacker config values to be set via Rails env config files
Expand All @@ -14,6 +15,12 @@ class Shakapacker::Engine < ::Rails::Engine
end
end

initializer "shakapacker.manager_checker" do
if File.exist?(Shakapacker::VersionChecker::NodePackageVersion.package_json_path)
Shakapacker::Utils::Manager.error_unless_package_manager_is_obvious!
end
end

initializer "shakapacker.proxy" do |app|
if (Shakapacker.config.dev_server.present? rescue nil)
app.middleware.insert_before 0,
Expand Down

0 comments on commit d6694e2

Please sign in to comment.