How to use the @vuepress/shared-utils.logger.success function in @vuepress/shared-utils

To help you get started, we’ve selected a few @vuepress/shared-utils 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 vuejs / vuepress / packages / @vuepress / core / lib / node / build / index.js View on Github external
// render pages
    logger.wait('Rendering static HTML...')

    const pagePaths = []
    for (const page of this.context.pages) {
      pagePaths.push(await this.renderPage(page))
    }

    readline.clearLine(process.stdout, 0)
    readline.cursorTo(process.stdout, 0)

    await this.context.pluginAPI.applyAsyncOption('generated', pagePaths)

    // DONE.
    const relativeDir = path.relative(this.context.cwd, this.outDir)
    logger.success(`Generated static files in ${chalk.cyan(relativeDir)}.`)
    const { duration } = performance.stop()
    logger.developer(`It took a total of ${chalk.cyan(`${duration}ms`)} to run the ${chalk.cyan('vuepress build')}.`)
    console.log()
  }
github vuejs / vuepress / packages / @vuepress / core / lib / build.js View on Github external
// render pages
  logger.wait('Rendering static HTML...')

  const pagePaths = []
  for (const page of ctx.pages) {
    pagePaths.push(await renderPage(page))
  }

  readline.clearLine(process.stdout, 0)
  readline.cursorTo(process.stdout, 0)

  await ctx.pluginAPI.options.generated.apply(pagePaths)

  // DONE.
  const relativeDir = path.relative(cwd, outDir)
  logger.success(`Generated static files in ${chalk.cyan(relativeDir)}.`)
  const { duration } = performance.stop()
  logger.developer(`It took a total of ${chalk.cyan(`${duration}ms`)} to run the ${chalk.cyan('vuepress build')}.`)
  console.log()

  // --- helpers ---

  function compile (config) {
    return new Promise((resolve, reject) => {
      webpack(config, (err, stats) => {
        if (err) {
          return reject(err)
        }
        if (stats.hasErrors()) {
          stats.toJson().errors.forEach(err => {
            console.error(err)
          })
github vuejs / vuepress / packages / @vuepress / core / lib / build.js View on Github external
await renderPage(page)
  }

  // if the user does not have a custom 404.md, generate the theme's default
  if (!options.pages.some(p => p.path === '/404.html')) {
    await renderPage({ path: '/404.html' })
  }

  readline.clearLine(process.stdout, 0)
  readline.cursorTo(process.stdout, 0)

  await options.pluginAPI.options.generated.apply()

  // DONE.
  const relativeDir = path.relative(process.cwd(), outDir)
  logger.success(`\n${chalk.green('Success!')} Generated static files in ${chalk.cyan(relativeDir)}.\n`)

  // --- helpers ---

  function compile (config) {
    return new Promise((resolve, reject) => {
      webpack(config, (err, stats) => {
        if (err) {
          return reject(err)
        }
        if (stats.hasErrors()) {
          stats.toJson().errors.forEach(err => {
            console.error(err)
          })
          reject(new Error(`Failed to compile with errors.`))
          return
        }
github vuejs / vuepress / packages / @vuepress / core / lib / node / webpack / DevLogPlugin.js View on Github external
compiler.hooks.done.tap('vuepress-log', stats => {
      if (shouldClearScreen) {
        clearScreen()
      }

      const time = new Date().toTimeString().match(/^[\d:]+/)[0]
      const displayUrl = `http://${displayHost}:${port}${publicPath}`

      logger.success(
        `${chalk.gray(`[${time}]`)} Build ${chalk.italic(stats.hash.slice(0, 6))} `
        + `finished in ${stats.endTime - stats.startTime} ms! `
        + (
          isFirst
            ? ''
            : `${chalk.gray(`(${displayUrl})`)}`
        )
      )
      if (isFirst) {
        isFirst = false
        console.log(`${chalk.gray('>')} VuePress dev server listening at ${chalk.cyan(displayUrl)}`)
        const { duration } = performance.stop()
        logger.developer(`It took a total of ${chalk.cyan(`${duration}ms`)} to run the ${chalk.cyan('vuepress dev')} for the first time.`)
      }
    })
    if (shouldClearScreen) {
github appcelerator / docs-devkit / packages / vuepress / vuepress-plugin-apidocs / index.js View on Github external
const command = [
            'node',
            docgenMainScript,
            '-f', 'json-raw',
            inputPaths.shift(),
            ...inputPaths.reduce((acc, cur) => {
              acc.push('-a', cur)
              return acc
            }, []),
            '-o', outputPath
          ]
          logger.wait('Generating API metadata file...')
          try {
            logger.debug(`Running command ${command.join(' ')}`)
            await execAsync(command.join(' '))
            logger.success(`Done! Metadata file generated to ${path.join(outputPath, 'api.json')}`)
          } catch (e) {
            logger.error('Failed to generate API metadata.')
            throw e
          }
        })
    }
github appcelerator / docs-devkit / packages / vuepress / vuepress-plugin-versioning / index.js View on Github external
return false
              }

              return true
            }
          })

          await snapshotSidebar(context.siteConfig, versionDestPath)
          if (typeof options.onNewVersion === 'function') {
            await options.onNewVersion(version, versionDestPath)
          }

          versions.unshift(version)
          await fs.writeFile(versionsFilePath, JSON.stringify(versions, null, 2))

          logger.success(`Snapshotted your current docs as version ${version}`)
          logger.tip(`You can find them under ${versionDestPath}`)
        })
    },
github ulivz / vuepress-plugin-export / index.js View on Github external
path: pagePath,
      url,
      title
    } = exportPages[i]

    await browserPage.goto(
      location,
      { waitUntil: 'networkidle2' }
    )

    await browserPage.pdf({
      path: pagePath,
      format: 'A4'
    })

    logger.success(`Generated ${yellow(title)} ${gray(`${url}`)}`)
  }

  const files = exportPages.map(({ path }) => path)
  const outputFilename = siteConfig.title || 'site'
  const outputFile = `${outputFilename}.pdf`

  await new Promise(resolve => {
    PDFMerge(files, outputFile, err => {
      if (err) {
        throw err
      }
      logger.success(`Export ${yellow(outputFile)} file!`)
      resolve()
    })
  })
github vuejs / vuepress / packages / @vuepress / core / lib / eject.js View on Github external
logger.debug('sourceDir', chalk.cyan(sourceDir))
  logger.debug('targetDir', chalk.cyan(targetDir))

  await fs.copy(sourceDir, targetDir, {
    filter: src => {
      const relative = path.relative(sourceDir, src)
      if (EXCLUDED_FILES.includes(relative)) {
        return false
      }
      if (relative) {
        logger.debug('Copied', chalk.cyan(relative))
      }
      return true
    }
  })
  logger.success(`Copied default theme into ${chalk.cyan(targetDir)}.\n`)
}