Class: Extension::Features::Argo::Base

Inherits:
Object
  • Object
show all
Includes:
SmartProperties
Defined in:
lib/project_types/extension/features/argo/base.rb

Direct Known Subclasses

Admin, Checkout

Constant Summary collapse

SCRIPT_PATH =
%w(build main.js).freeze

Instance Method Summary collapse

Instance Method Details

#config(context) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/project_types/extension/features/argo/base.rb', line 30

def config(context)
  js_system = ShopifyCli::JsSystem.new(ctx: context)
  if js_system.package_manager == 'yarn'
    run_yarn_install(context, js_system)
    run_yarn_run_script(context, js_system)
  end
  filepath = File.join(context.root, SCRIPT_PATH)
  context.abort(context.message('features.argo.missing_file_error')) unless File.exist?(filepath)
  begin
    {
      renderer_version: extract_argo_renderer_version(context),
      serialized_script: Base64.strict_encode64(File.read(filepath).chomp),
    }
  rescue StandardError
    context.abort(context.message('features.argo.script_prepare_error'))
  end
end

#create(directory_name, identifier, context) ⇒ Object



26
27
28
# File 'lib/project_types/extension/features/argo/base.rb', line 26

def create(directory_name, identifier, context)
  Features::ArgoSetup.new(git_template: git_template).call(directory_name, identifier, context)
end

#git_templateObject

Raises:

  • (NotImplementedError)


48
49
50
# File 'lib/project_types/extension/features/argo/base.rb', line 48

def git_template
  raise NotImplementedError, "'#{__method__}' must be implemented for #{self.class}"
end

#renderer_package_nameObject

Raises:

  • (NotImplementedError)


52
53
54
55
56
57
58
59
# File 'lib/project_types/extension/features/argo/base.rb', line 52

def renderer_package_name
  # The renderer_package_name is used as a regex pattern to
  # find a match in the output of yarn or npm list command.
  # Use the full package name as it appears in the template without targeting a version.
  # Examples: "@shopify/some-renderer-package", "argo-renderer-package"

  raise NotImplementedError, "'#{__method__}' must be implemented for #{self.class}"
end