How to use the @vtex/api.Housekeeper function in @vtex/api

To help you get started, we’ve selected a few @vtex/api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vtex / toolbelt / src / modules / housekeeper / update.ts View on Github external
export default async () => {
  const housekeeper = new Housekeeper(getIOContext(), IOClientOptions)
  const getSpinner = ora('Getting available updates').start()
  const resolvedUpdates = await housekeeper.resolve()
  getSpinner.stop()
  if (!hasAvailableUpdates(resolvedUpdates)) {
    log.info('No updates available')
    return
  }
  printUpdates(resolvedUpdates)
  const confirm = await promptUpdate()
  if (!confirm) {
    return
  }
  const applySpinner = ora('Applying updates').start()
  await housekeeper.apply(resolvedUpdates)
  applySpinner.stop()
}
github vtex / toolbelt / src / modules / apps / update.ts View on Github external
export default async () => {
  const housekeeper = new Housekeeper(getIOContext(), IOClientOptions)
  const getSpinner = ora('Getting available updates').start()
  const resolvedUpdates = await housekeeper.resolve()
  getSpinner.stop()
  const hasAvailableUpdates =
    printAppsDiff(resolvedUpdates, `The following infra apps will be updated`, ['infra']) ||
    printAppsDiff(resolvedUpdates, `The following installed apps will be updated:`, ['apps'], sourceFilter('installation'), pluck('id')) ||
    printAppsDiff(resolvedUpdates, `The following dependencies will be updated:`, ['apps'], sourceFilter('dependency'), pluck('id')) ||
    printAppsDiff(resolvedUpdates, `The following edition apps will be updated`, ['apps'], sourceFilter('edition'), pluck('id')) ||
    printEditionAppsDiff(resolvedUpdates)
    if (!hasAvailableUpdates) {
    log.info('No updates available')
  }

  const confirm = await promptUpdate()
  if (!confirm) {
    return