Sha256: 180c41823153477b4659bea530aeee6e768b1b3d8da1d98b978f964ffc5b6013

Contents?: true

Size: 679 Bytes

Versions: 12

Compression:

Stored size: 679 Bytes

Contents

module SewingKit
  module Webpack
    class Compiler
      def compile
        result = Kernel.system(
          { 'NODE_ENV' => node_env },
          *command,
          chdir: Rails.root.to_s,
          out: $stdout,
          err: $stderr,
        )

        if !result
          puts "sewing-kit compile failed with error code #{$?}"
          exit(1)
        end
        result
      end

      private

      def command
        [
          'node_modules/.bin/sewing-kit',
          'build',
          '--mode',
          node_env,
        ].reject(&:empty?)
      end

      private
      def node_env
        ENV['NODE_ENV'] || Rails.env.to_s
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sewing_kit-0.7.1 lib/sewing_kit/webpack/compiler.rb
sewing_kit-0.7.0 lib/sewing_kit/webpack/compiler.rb
sewing_kit-0.6.2 lib/sewing_kit/webpack/compiler.rb
sewing_kit-0.6.1 lib/sewing_kit/webpack/compiler.rb
sewing_kit-0.6.0 lib/sewing_kit/webpack/compiler.rb
sewing_kit-0.5.8 lib/sewing_kit/webpack/compiler.rb
sewing_kit-0.5.7 lib/sewing_kit/webpack/compiler.rb
sewing_kit-0.5.6 lib/sewing_kit/webpack/compiler.rb
sewing_kit-0.5.5 lib/sewing_kit/webpack/compiler.rb
sewing_kit-0.5.4 lib/sewing_kit/webpack/compiler.rb
sewing_kit-0.5.1 lib/sewing_kit/webpack/compiler.rb
sewing_kit-0.5.0 lib/sewing_kit/webpack/compiler.rb