Sha256: 2279e0485a56c728c09140a330aa019c04da6cff0535effda6958b42a73e4ab2

Contents?: true

Size: 984 Bytes

Versions: 4

Compression:

Stored size: 984 Bytes

Contents

module Extension
  module Features
    class ArgoRuntime
      include SmartProperties

      UI_EXTENSIONS_CHECKOUT_RUN = "@shopify/checkout-ui-extensions-run"
      UI_EXTENSIONS_ADMIN_RUN = "@shopify/admin-ui-extensions-run"

      ADMIN_RUN_FLAGS = [
        :api_key,
        :name,
        :port,
        :public_url,
        :renderer_version,
        :shop,
        :uuid,
      ]

      CHECKOUT_RUN_FLAGS = [
        :port,
        :public_url,
      ]

      property! :renderer, accepts: Models::NpmPackage
      property! :cli, accepts: Models::NpmPackage

      def supports?(flag)
        case cli
        when admin?
          ADMIN_RUN_FLAGS.include?(flag.to_sym)
        when checkout?
          CHECKOUT_RUN_FLAGS.include?(flag.to_sym)
        end
      end

      private

      def admin?
        ->(cli) { cli.name == UI_EXTENSIONS_ADMIN_RUN }
      end

      def checkout?
        ->(cli) { cli.name == UI_EXTENSIONS_CHECKOUT_RUN }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shopify-cli-2.1.0 lib/project_types/extension/features/argo_runtime.rb
shopify-cli-2.0.2 lib/project_types/extension/features/argo_runtime.rb
shopify-cli-2.0.1 lib/project_types/extension/features/argo_runtime.rb
shopify-cli-2.0.0 lib/project_types/extension/features/argo_runtime.rb