How to use the @vuepress/shared-utils.logger.error 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 / dev.js View on Github external
prepare(sourceDir, cliOptions, false /* isProd */).catch(err => {
      console.error(logger.error(chalk.red(err.stack), false))
    })
  }
github vuejs / vuepress / packages / @vuepress / core / lib / node / build / index.js View on Github external
const pageMeta = renderPageMeta(meta)

    const context = {
      url: page.path,
      userHeadTags: this.userHeadTags,
      pageMeta,
      title: 'VuePress',
      lang: 'en',
      description: ''
    }

    let html
    try {
      html = await this.renderer.renderToString(context)
    } catch (e) {
      console.error(logger.error(chalk.red(`Error rendering ${pagePath}:`), false))
      throw e
    }
    const filename = pagePath.replace(/\/$/, '/index.html').replace(/^\//, '')
    const filePath = path.resolve(this.outDir, filename)
    await fs.ensureDir(path.dirname(filePath))
    await fs.writeFile(filePath, html)
    return filePath
  }
}
github appcelerator / docs-devkit / packages / vuepress / vuepress-plugin-versioning / index.js View on Github external
.action(async (dir, version,) => {
          if (versions.includes(version)) {
            logger.error(`Version ${version} already exists in version.json. Please use a different version.`)
            return
          }

          logger.wait(`Creating new version ${version} ...`)

          const versionDestPath = path.join(versionedSourceDir, version)
          await fs.copy(context.sourceDir, versionDestPath, {
            filter: (src, dest) => {
              if (src === context.vuepressDir) {
                return false
              }

              return true
            }
          })
github appcelerator / docs-devkit / packages / vuepress / vuepress-plugin-apidocs / index.js View on Github external
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 vuejs / vuepress / packages / @vuepress / core / lib / build.js View on Github external
const pageMeta = renderPageMeta(meta)

    const context = {
      url: pagePath,
      userHeadTags,
      pageMeta,
      title: 'VuePress',
      lang: 'en',
      description: ''
    }

    let html
    try {
      html = await renderer.renderToString(context)
    } catch (e) {
      console.error(logger.error(chalk.red(`Error rendering ${pagePath}:`), false))
      throw e
    }
    const filename = decodeURIComponent(pagePath.replace(/\/$/, '/index.html').replace(/^\//, ''))
    const filePath = path.resolve(outDir, filename)
    await fs.ensureDir(path.dirname(filePath))
    await fs.writeFile(filePath, html)
  }
github vuejs / vuepress / packages / @vuepress / core / lib / build.js View on Github external
const pageMeta = renderPageMeta(meta)

    const context = {
      url: pagePath,
      userHeadTags,
      pageMeta,
      title: 'VuePress',
      lang: 'en',
      description: ''
    }

    let html
    try {
      html = await renderer.renderToString(context)
    } catch (e) {
      console.error(logger.error(chalk.red(`Error rendering ${pagePath}:`), false))
      throw e
    }
    const filename = decodeURIComponent(pagePath.replace(/\/$/, '/index.html').replace(/^\//, ''))
    const filePath = path.resolve(outDir, filename)
    await fs.ensureDir(path.dirname(filePath))
    await fs.writeFile(filePath, html)
    return filePath
  }
github vuejs / vuepress / packages / @vuepress / core / lib / node / plugin-api / abstract / Option.js View on Github external
syncApply (...args) {
    const rawItems = this.items
    this.items = []
    this.appliedItems = this.items

    for (const { name, value } of rawItems) {
      try {
        this.add(
          name,
          isFunction(value)
            ? value(...args)
            : value
        )
      } catch (error) {
        logger.error(`${chalk.cyan(name)} apply ${chalk.cyan(this.key)} failed.`)
        throw error
      }
    }

    this.items = rawItems
  }
github vuejs / vuepress / packages / @vuepress / core / lib / node / plugin-api / abstract / AsyncOption.js View on Github external
async asyncApply (...args) {
    const rawItems = this.items
    this.items = []
    this.appliedItems = this.items

    for (const { name, value } of rawItems) {
      try {
        this.add(
          name,
          isFunction(value)
            ? await value(...args)
            : value
        )
      } catch (error) {
        logger.error(`${chalk.cyan(name)} apply ${chalk.cyan(this.key)} failed.`)
        throw error
      }
    }

    this.items = rawItems
  }
github vuejs / vuepress / packages / @vuepress / markdown / lib / snippet.js View on Github external
md.renderer.rules.fence = (...args) => {
    const [tokens, idx, , { loader }] = args
    const token = tokens[idx]
    const { src } = token
    if (src) {
      if (loader) {
        loader.addDependency(src)
      }
      if (fs.existsSync(src)) {
        token.content = fs.readFileSync(src, 'utf8')
      } else {
        token.content = `Code snippet path not found: ${src}`
        token.info = ''
        logger.error(token.content)
      }
    }
    return fence(...args)
  }
github vuejs / vuepress / packages / @vuepress / core / lib / node / plugin-api / abstract / AsyncOption.js View on Github external
await Promise.all(rawItems.map(async ({ name, value }) => {
      try {
        this.add(
          name,
          isFunction(value)
            ? await value(...args)
            : value
        )
      } catch (error) {
        logger.error(`${chalk.cyan(name)} apply ${chalk.cyan(this.key)} failed.`)
        throw error
      }
    })).catch(error => {
      throw error