Sha256: 62179c404f8ba2a624043711268ca5815159c3eb6698933150e4d75d5ee0b459

Contents?: true

Size: 1011 Bytes

Versions: 1

Compression:

Stored size: 1011 Bytes

Contents

# frozen_string_literal: true
require "shopify_cli"

module Extension
  module Tasks
    module Converters
      module ServerConfigConverter
        def self.from_hash(hash:, type:, registration_uuid:)
          context.abort(context.message("tasks.errors.parse_error")) if hash.nil?

          extension = Models::ServerConfig::Extension.new(
            uuid: registration_uuid,
            type: type.upcase,
            user: Models::ServerConfig::User.new,
            development: Models::ServerConfig::Development.new(
              build_dir: hash.dig("development", "build_dir"),
              renderer: Models::ServerConfig::DevelopmentRenderer.find(type),
              entries: Models::ServerConfig::DevelopmentEntries.new(
                main: hash.dig("development", "entries", "main")
              )
            ),
            extension_points: hash.dig("extension_points")
          )

          Models::ServerConfig::Root.new(extensions: [extension])
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shopify-cli-2.6.6 lib/project_types/extension/tasks/converters/server_config_converter.rb