Sha256: 3fe80016d098682c9dab9d32b477eb5c4db581f5697624ad249c980f5a75c89a

Contents?: true

Size: 1.8 KB

Versions: 20

Compression:

Stored size: 1.8 KB

Contents

# frozen_string_literal: true

module Extension
  module Features
    module ArgoSetupSteps
      YARN_INITIALIZE_COMMAND = %w(generate).freeze
      NPM_INITIALIZE_COMMAND = %w(run generate --).freeze
      INITIALIZE_TYPE_PARAMETER = "--type=%s"

      def self.check_dependencies(dependency_checks)
        ArgoSetupStep.always_successful do |context, _identifier, _directory_name, _js_system|
          dependency_checks.each do |dependency_check|
            dependency_check.call(context)
          end
        end
      end

      def self.clone_template(git_template)
        ArgoSetupStep.default do |context, _identifier, directory_name, _js_system|
          begin
            ShopifyCli::Git.clone(git_template, directory_name, ctx: context)
            context.root = File.join(context.root, directory_name)
          rescue StandardError
            context.puts("{{x}} Unable to clone the repository.")
          end
        end
      end

      def self.install_dependencies
        ArgoSetupStep.default do |context, _identifier, _directory_name, js_system|
          ShopifyCli::JsDeps.new(ctx: context, system: js_system).install
        end
      end

      def self.initialize_project
        ArgoSetupStep.default do |context, identifier, _directory_name, js_system|
          frame_title = context.message("create.setup_project_frame_title")
          failure_message = context.message("features.argo.initialization_error")

          result = true
          CLI::UI::Frame.open(frame_title, failure_text: failure_message) do
            result = js_system.call(
              yarn: YARN_INITIALIZE_COMMAND + [INITIALIZE_TYPE_PARAMETER % identifier],
              npm: NPM_INITIALIZE_COMMAND + [INITIALIZE_TYPE_PARAMETER % identifier]
            )
          end

          result
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
shopify-cli-2.4.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.3.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.2.2 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.2.1 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.2.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.1.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.0.2 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.0.1 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.0.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-1.14.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-1.13.1 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-1.13.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-1.12.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-1.11.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-1.10.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-1.9.1 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-1.9.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-1.8.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-1.7.1 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-1.7.0 lib/project_types/extension/features/argo_setup_steps.rb