Sha256: 300041cdc5bcb8f2415510a3b32db030b36b0c9378c293488d9a81e686bee0c6

Contents?: true

Size: 983 Bytes

Versions: 6

Compression:

Stored size: 983 Bytes

Contents

# frozen_string_literal: true
require "shopify_cli"

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

          project = ExtensionProject.current

          extension = Models::ServerConfig::Extension.new(
            uuid: project.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")
              )
            )
          )

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shopify-cli-2.6.5 lib/project_types/extension/tasks/converters/server_config_converter.rb
shopify-cli-2.6.4 lib/project_types/extension/tasks/converters/server_config_converter.rb
shopify-cli-2.6.3 lib/project_types/extension/tasks/converters/server_config_converter.rb
shopify-cli-2.6.2 lib/project_types/extension/tasks/converters/server_config_converter.rb
shopify-cli-2.6.1 lib/project_types/extension/tasks/converters/server_config_converter.rb
shopify-cli-2.6.0 lib/project_types/extension/tasks/converters/server_config_converter.rb