How to use the consola.log 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 Akryum / nodepack / packages / @nodepack / cli / src / lib / PluginAddJob.js View on Github external
// Installation
          if (isTestOrDebug) {
            pkg.devDependencies = pkg.devDependencies || {}
            pkg.devDependencies[packageName] = await getPackageTaggedVersion(packageName).then(version => version && `^${version}`) || 'latest'
            writePkg(cwd, pkg)
          } else if ((!alreadyInPkg || cliOptions.forceInstall) && !cliOptions.noInstall) {
            await shouldCommitState(`[nodepack] before add ${packageName}`, true)
            consola.log('')
            consola.log(`📦  Installing ${chalk.cyan(packageName)}...`)
            consola.log('')

            const packageManager = loadGlobalOptions().packageManager || getPkgCommand(cwd)
            await installPackage(cwd, packageManager, cliOptions.registry, packageName)

            consola.log(`${chalk.green('✔')}  Successfully installed plugin: ${chalk.cyan(packageName)}`)
            consola.log('')
          }

          if (!alreadyInPkg) {
            plugins.push(packageName)
          }

          if (!plugins.includes(packageName)) {
            consola.error(`${packageName} is not installed, can't continue the installation`)
            process.exit(1)
          }
        },
        after: async ({ shouldCommitState }) => {
github Akryum / nodepack / packages / @nodepack / cli / src / lib / ProjectCreateJob.js View on Github external
if (shouldInitGit) {
            const { success } = await commitOnGit(cwd, cliOptions, isTestOrDebug, `[nodepack] create project`)
            gitCommitSuccess = success
          }
          stopSpinner()

          // save preset
          if (this.isPresetManual) {
            await this.askSavePreset(finalPreset)
          }

          // log instructions
          if (!cliOptions.skipGetStarted) {
            consola.log('')
            consola.success(`🎉  Successfully created project ${chalk.yellow(projectName)}.`)
            consola.log(
              `👉  Get started with the following commands:\n\n` +
              (cwd === process.cwd() ? `` : chalk.cyan(` ${chalk.gray('$')} cd ${projectName}\n`)) +
              chalk.cyan(` ${chalk.gray('$')} nodepack`),
            )
            consola.log('')
          }

          if (!gitCommitSuccess) {
            consola.warn(
              `Skipped git commit due to missing username and email in git config.\n` +
              `You will need to perform the initial commit yourself.\n`,
            )
          }
        },
      },
github MrDemonWolf / share / src / index.js View on Github external
app.listen(app.get('port'), () => {
    consola.ready({
      message: 'Web',
      badge: true
    });
    // Log infomation after everything is started.
    consola.log('----------------------------------------');
    consola.info(`Environment: ${app.get('env')}`);
    consola.info(`Base URL: http://localhost:${app.get('port')}`);
    consola.log('----------------------------------------');
  });
});
github richardeschloss / nuxt-socket-io / test / specs / Module.spec.js View on Github external
test('Module adds plugin correctly', (t) => {
  consola.log('Testing with moduleOptions:', modOptions)
  return new Promise((resolve) => {
    const simpleNuxt = {
      addPlugin({ src, fileName, options }) {
        t.is(src, path.resolve(srcDir, 'io/plugin.js'))
        t.is(fileName, 'nuxt-socket-io.js')
        t.truthy(options.sockets)
        t.true(options.sockets.length > 0)
        options.sockets.forEach((s, idx) => {
          Object.entries(s).forEach(([key, entry]) => {
            t.is(entry, modOptions.io.sockets[idx][key])
          })
        })
        resolve()
      },
      options: {
        srcDir,
github nuxt / nuxt.js / test / fixtures / cli / cli.build.config.js View on Github external
hook('build:done', () => {
      consola.log('Compiled successfully')
    })
    hook('listen', (server, { port, host }) => {
github Akryum / nodepack / packages / @nodepack / app-migrator / src / lib / Migrator.ts View on Github external
async displayNotices () {
    if (this.notices.length) {
      this.notices.forEach(({ pluginId, message, type }) => {
        const shortId = toShortPluginId(pluginId)
        const logFn = logTypes[type]
        if (!logFn) {
          consola.error(`Invalid api.addNotice type '${type}'.`, shortId)
        } else {
          const tag = message ? shortId : null
          logFn(message, tag)
        }
      })
      consola.log('')
    }
  }
}
github nuxt / nuxt.js / packages / cli / src / commands / dev.js View on Github external
logChanged ({ event, path }) {
    const { icon, color, action } = eventsMapping[event] || eventsMapping.change

    consola.log({
      type: event,
      icon: chalk[color].bold(icon),
      message: `${action} ${chalk.cyan(formatPath(path))}`
    })
  },
github Akryum / nodepack / packages / @nodepack / maintenance / src / lib / Maintenance.ts View on Github external
async buildFragments (entryNames) {
    if (this.fragmentsBuilt || this.skipBuild) return

    consola.log(`🔨️  Building fragments ${chalk.blue(entryNames.join(', '))}...`)

    try {
      const io = process.env.NODEPACK_DEBUG === 'true' ? 'inherit' : 'ignore'
      const result = await execa('nodepack-service', [
        'build',
        '--silent',
        '--no-autoNodeEnv',
        '--no-preInstall',
      ], {
        cwd: this.cwd,
        env: {
          NODEPACK_ENTRIES: entryNames.join(','),
          NODEPACK_NO_MAINTENANCE: 'true',
          NODEPACK_OUTPUT: '.nodepack/temp/fragments/',
          NODEPACK_RAW_STATS: 'true',
          NODEPACK_MAINTENANCE_FRAGMENTS: 'true',
github nuxt / now-builder / src / utils.ts View on Github external
export function startStep (step: string): void {
  endStep()
  consola.log(dash + step + dash)
  _step = step
  _stepStartTime = process.hrtime()
}