Class: Extension::Commands::Build

Inherits:
ExtensionCommand show all
Defined in:
lib/project_types/extension/commands/build.rb

Constant Summary collapse

YARN_BUILD_COMMAND =
%w(build)
NPM_BUILD_COMMAND =
%w(run-script build)

Instance Attribute Summary

Attributes inherited from ShopifyCli::Command

#ctx, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ExtensionCommand

#extension_type, #project

Methods inherited from ShopifyCli::Command

call, call_help, #initialize, options, prerequisite_task, run_prerequisites, subcommand, subcommand_registry

Methods included from ShopifyCli::Feature::Set

#hidden?, #hidden_feature

Constructor Details

This class inherits a constructor from ShopifyCli::Command

Class Method Details

.helpObject



21
22
23
24
25
26
# File 'lib/project_types/extension/commands/build.rb', line 21

def self.help
  <<~HELP
    Build your extension to prepare for deployment.
      Usage: {{command:#{ShopifyCli::TOOL_NAME} build}}
  HELP
end

Instance Method Details

#call(_args, _command_name) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/project_types/extension/commands/build.rb', line 12

def call(_args, _command_name)
  system = ShopifyCli::JsSystem.new(ctx: @ctx)

  CLI::UI::Frame.open(@ctx.message('build.frame_title', system.package_manager)) do
    success = system.call(yarn: YARN_BUILD_COMMAND, npm: NPM_BUILD_COMMAND)
    @ctx.abort(@ctx.message('build.build_failure_message')) unless success
  end
end