Sha256: d45d974e40a3822730f018509e632f51c8f5bd73f4568f91a0415b321245a297

Contents?: true

Size: 894 Bytes

Versions: 6

Compression:

Stored size: 894 Bytes

Contents

module Webpacker
  class Runner
    def self.run(argv)
      $stdout.sync = true
      ENV["NODE_ENV"] ||= (ENV["RAILS_ENV"] == "production") ? "production" : "development"
      new(argv).run
    end

    def initialize(argv)
      @argv = argv

      @app_path              = File.expand_path(".", Dir.pwd)
      @node_modules_bin_path = ENV["WEBPACKER_NODE_MODULES_BIN_PATH"] || `yarn bin`.chomp
      @webpack_config        = File.join(@app_path, "config/webpack/webpack.config.js")
      @webpacker_config      = ENV["WEBPACKER_CONFIG"] || File.join(@app_path, "config/webpacker.yml")

      unless File.exist?(@webpack_config)
        $stderr.puts "webpack config #{@webpack_config} not found, please run 'bundle exec rails webpacker:install' to install Webpacker with default configs or add the missing config file for your custom environment."
        exit!
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shakapacker-6.6.0 lib/webpacker/runner.rb
shakapacker-6.5.6 lib/webpacker/runner.rb
shakapacker-6.5.5 lib/webpacker/runner.rb
shakapacker-6.5.4 lib/webpacker/runner.rb
shakapacker-6.5.3 lib/webpacker/runner.rb
shakapacker-6.5.2 lib/webpacker/runner.rb