Sha256: 792c8f080bbbceca35c1ab6f59b00c61f88bf6824643e0a02bcffc1c26b573c6

Contents?: true

Size: 740 Bytes

Versions: 2

Compression:

Stored size: 740 Bytes

Contents

# frozen_string_literal: true

module Script
  module Layers
    module Infrastructure
      class NoopBuilder
        def initialize(script)
          @script = script
        end

        def build
          File.read(@script.filename)
        end

        def compiled_type
          @script.language
        end
      end

      class ScriptBuilder
        COMPILERS = {
          "ts" => Infrastructure::AssemblyScriptWasmBuilder,
          "js" => Infrastructure::NoopBuilder,
          "json" => Infrastructure::NoopBuilder,
        }

        def self.for(script)
          raise Errors::BuilderNotFoundError unless COMPILERS[script.language]
          COMPILERS[script.language].new(script)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shopify-cli-0.9.1 lib/project_types/script/layers/infrastructure/script_builder.rb
shopify-cli-0.9.0 lib/project_types/script/layers/infrastructure/script_builder.rb