Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

class ShopifyCli::JsDeps

Tim Anema edited this page Jul 21, 2020 · 4 revisions

ShopifyCli::JsDeps ensures that all JavaScript dependencies are installed for projects.

Class Methods

install

install(ctx, verbose = false) Proxy to instance method ShopifyCli::JsDeps.new.install.

Parameters

  • ctx: running context from your command
  • verbose: whether to run the installation tools in silent mode

Example

ShopifyCli::JsDeps.install(ctx)
see source

# File lib/shopify-cli/js_deps.rb, line 24
def self.install(ctx, verbose = false)
  new(ctx: ctx).install(verbose)
end

Instance Methods

install

install(verbose = false) Installs all of a project's JavaScript dependencies using Yarn or NPM, based on the project's settings.

Parameters

  • verbose: whether to run the installation tools in silent mode

Example

# context is the running context for the command
ShopifyCli::JsDeps.new(context).install(true)
see source

# File lib/shopify-cli/js_deps.rb, line 39
def install(verbose = false)
  title = ctx.message('core.js_deps.installing', @system.package_manager)
  success = ctx.message('core.js_deps.installed')
  failure = ctx.message('core.js_deps.error.install_error', @system.package_manager)

  CLI::UI::Frame.open(title, success_text: success, failure_text: failure) do
    @system.call(
      yarn: -> { yarn(verbose) },
      npm: -> { npm(verbose) }
    )
  end
end

Includes

  • SmartProperties
Clone this wiki locally