Sha256: b03a7fb05e429434c9e81d269ebc180087ae053fecd337ebbe22e3d86eef4da1

Contents?: true

Size: 1.41 KB

Versions: 6

Compression:

Stored size: 1.41 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,
                    compiled_type: task_runner.compiled_type,
                    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

6 entries across 6 versions & 1 rubygems

Version Path
shopify-cli-2.10.0 lib/project_types/script/layers/application/build_script.rb
shopify-cli-2.9.0 lib/project_types/script/layers/application/build_script.rb
shopify-cli-2.8.0 lib/project_types/script/layers/application/build_script.rb
shopify-cli-2.7.4 lib/project_types/script/layers/application/build_script.rb
shopify-cli-2.7.3 lib/project_types/script/layers/application/build_script.rb
shopify-cli-2.7.2 lib/project_types/script/layers/application/build_script.rb