Sha256: e6b8509e026688dc5c3a3a4064197286143cd79db3f6af886ffafa3ec4263796

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

module Script
  module Layers
    module Application
      class BuildScript
        class << self
          def call(ctx:, task_runner:, script_project:, library:)
            CLI::UI::Frame.open(ctx.message("script.application.building")) do
              begin
                UI::StrictSpinner.spin(ctx.message("script.application.building_script")) do |spinner|
                  Infrastructure::PushPackageRepository.new(ctx: ctx).create_push_package(
                    script_project: script_project,
                    script_content: task_runner.build,
                    metadata: task_runner.metadata,
                    library: library,
                  )
                  spinner.update_title(ctx.message("script.application.built"))
                end
              rescue StandardError => e
                CLI::UI::Frame.with_frame_color_override(:red) do
                  ctx.puts("\n{{red:#{e.message}}}")
                end
                errors = [
                  Infrastructure::Errors::BuildScriptNotFoundError,
                  Infrastructure::Errors::WebAssemblyBinaryNotFoundError,
                ]

                raise Infrastructure::Errors::BuildError unless errors.any? { |err| e.is_a?(err) }
                raise
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shopify-cli-2.10.1 lib/project_types/script/layers/application/build_script.rb