Sha256: dcfb7f74084b234648fdd2349d54bab0fd1eccda9ec4f02dd567ab825648bb16

Contents?: true

Size: 1.8 KB

Versions: 22

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

22 entries across 22 versions & 1 rubygems

Version Path
shopify-cli-2.12.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.11.2 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.11.1 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.11.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.10.2 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.10.1 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.10.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.9.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.8.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.7.4 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.7.3 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.7.2 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.7.1 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.7.0 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.6.6 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.6.5 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.6.4 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.6.3 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.6.2 lib/project_types/extension/features/argo_setup_steps.rb
shopify-cli-2.6.1 lib/project_types/extension/features/argo_setup_steps.rb