How to use the consola.fatal function in consola

To help you get started, we’ve selected a few consola 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 nuxt / nuxt.js / distributions / nuxt-ts / bin / nuxt-ts.js View on Github external
.catch((error) => {
    require('consola').fatal(error)
    process.exit(2)
  })
github nuxt / nuxt.js / packages / cli / src / command.js View on Github external
let cmdError

    try {
      await this.cmd.run(this)
    } catch (e) {
      cmdError = e
    }

    if (this.argv.lock) {
      await this.releaseLock()
    }

    if (this.argv['force-exit']) {
      const forceExitByUser = this.isUserSuppliedArg('force-exit')
      if (cmdError) {
        consola.fatal(cmdError)
      }
      forceExit(this.cmd.name, forceExitByUser ? false : forceExitTimeout)
      if (forceExitByUser) {
        return
      }
    }

    if (cmdError) {
      throw cmdError
    }
  }
github nuxt / press / distributions / blueprint / src / cli / commands.js View on Github external
static async eject (args) {
    const [blueprint, key] = args[0].split('/')

    if (!(blueprint in blueprints)) {
      consola.fatal('Unrecognized template bundle -- see docs at https://nuxt.press/')
      return
    }

    if (key === 'theme') {
      await ejectTheme(blueprint)
      return
    }

    if (key) {
      if (!blueprints[blueprint].templates[key]) {
        consola.fatal('Unrecognized template key -- see docs at https://nuxt.press/')
        return
      }

      let template = blueprints[blueprint].templates[key]
      if (Array.isArray(template)) {
github nuxt / fabula / src / ssh.js View on Github external
function exit(err) {
  consola.fatal(err.message || err)
  process.exit()
}
github nuxt / fabula / bin / fabula.js View on Github external
#!/usr/bin/env node

const consola = require('consola')

try {
  require('esm')(module)('../dist/fabula')
    .cli().catch((err) => {
      consola.fatal(err)
      process.exit(1)
    })
} catch (err) {
  consola.fatal(err)
  process.exit(1)
}
github nuxt / press / packages / cli / src / commands.js View on Github external
static async eject (args) {
    const [blueprint, key] = args[0].split('/')

    if (!(blueprint in blueprints)) {
      consola.fatal('Unrecognized template bundle -- see docs at https://nuxt.press/')
      return
    }

    if (key === 'theme') {
      await ejectTheme(blueprint)
      return
    }

    if (key) {
      if (!blueprints[blueprint].templates[key]) {
        consola.fatal('Unrecognized template key -- see docs at https://nuxt.press/')
        return
      }

      let template = blueprints[blueprint].templates[key]
      if (Array.isArray(template)) {
        template = template[0]
      }
      await ejectTemplate(blueprint, template)
      return
    }

    for (let template of Object.values(blueprints[blueprint].templates)) {
      if (Array.isArray(template)) {
        template = template[0]
      }
      await ejectTemplate(blueprint, template)
github nuxt / nuxt.js / packages / cli / bin / nuxt-cli.js View on Github external
.catch((error) => {
    require('consola').fatal(error)
    require('exit')(2)
  })
github nuxt / nuxt.js / packages / common / src / utils.js View on Github external
const dir1 = get(options, key1, false)
  const dir2 = get(options, key2, false)

  if (
    dir1 &&
    dir2 &&
    (
      dir1 === dir2 ||
      (
        dir1.startsWith(dir2) &&
        !path.basename(dir1).startsWith(path.basename(dir2))
      )
    )
  ) {
    const errorMessage = `options.${key2} cannot be a parent of or same as ${key1}`
    consola.fatal(errorMessage)
    throw new Error(errorMessage)
  }
}
github bakjs / bak / packages / bak / bin / cli / commands / dev.js View on Github external
nodemon.on('crash', () => {
      consola.fatal('Server has crashed!')
      consola.info('Fix code or use `rs` command to restart server immediately.')
    })