module ReactOnRails::PackerUtils

def self.hook_contains_generate_packs?(hook_value)

def self.hook_contains_generate_packs?(hook_value)
  # The hook value can be either:
  # 1. A direct command containing the rake task
  # 2. A path to a script file that needs to be read
  return false if hook_value.blank?
  # Check if it's a direct command first
  return true if hook_value.to_s.match?(/\breact_on_rails:generate_packs\b/)
  # Check if it's a script file path
  script_path = resolve_hook_script_path(hook_value)
  return false unless script_path && File.exist?(script_path)
  # Read and check script contents
  script_contents = File.read(script_path)
  script_contents.match?(/\breact_on_rails:generate_packs\b/)
rescue StandardError
  # If we can't read the script, assume it doesn't contain generate_packs
  false
end