How to use the @vuepress/shared-utils.logger.tip 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 / prepare / resolveOptions.js View on Github external
try {
        themeIndexFile = requireResolve(`vuepress-theme-${theme}/index.js`)
      } catch (e) {
        try {
          themeIndexFile = requireResolve(`@vuepress/theme-${theme}`)
          themePath = path.dirname(themeIndexFile)
          themeIndexFile = require(themeIndexFile)
          themeLayoutPath = themeIndexFile.layout
          themeNotFoundPath = themeIndexFile.notFound
          themePlugins = themeIndexFile.plugins
        } catch (e) {
          throw new Error(`[vuepress] Failed to load custom theme "${theme}". File vuepress-theme-${theme}/Layout.vue does not exist.`)
        }
      }
    }
    logger.tip(`\nApply theme ${chalk.gray(theme)}`)
  } else {
    throw new Error(`[vuepress] You must specify a theme, or create a local custom theme. \n For more details, refer to https://vuepress.vuejs.org/guide/custom-themes.html#custom-themes. \n`)
  }

  // resolve theme config
  const themeConfig = siteConfig.themeConfig || {}

  // resolve markdown
  const markdown = createMarkdown(siteConfig)

  // resolve pageFiles
  const patterns = ['**/*.md', '!.vuepress', '!node_modules']
  if (siteConfig.dest) {
    // #654 exclude dest folder when dest dir was set in
    // sourceDir but not in '.vuepress'
    const outDirRelative = path.relative(sourceDir, outDir)
github vuejs / vuepress / packages / vuepress / lib / handleUnknownCommand.js View on Github external
logger.debug('global_options', options)
    logger.debug('cli_options', commandoptions)
    logger.debug('cli_args', args)

    const [commandName] = args
    const sourceDir = args[1] ? path.resolve(args[1]) : pwd
    const inferredUserDocsDirectory = await inferUserDocsDirectory(pwd)
    logger.developer('inferredUserDocsDirectory', inferredUserDocsDirectory)
    logger.developer('sourceDir', sourceDir)

    if (inferredUserDocsDirectory && sourceDir !== inferredUserDocsDirectory) {
      logUnknownCommand(cli)
      console.log()
      logger.tip(`Did you miss to specify the target docs dir? e.g. ${chalk.cyan(`vuepress ${commandName} [targetDir]`)}.`)
      logger.tip(`A custom command registered by a plugin requires VuePress to locate your site configuration like ${chalk.cyan('vuepress dev')} or ${chalk.cyan('vuepress build')}.`)
      console.log()
      process.exit(1)
    }

    if (!inferredUserDocsDirectory) {
      logUnknownCommand(cli)
      process.exit(1)
    }

    logger.debug('Custom command', chalk.cyan(commandName))
    CLI({
      async beforeParse (subCli) {
        const app = createApp({
          sourceDir: sourceDir,
          ...options,
          ...commandoptions
github vuejs / vuepress / packages / @vuepress / core / lib / node / loadTheme.js View on Github external
let name
  let shortcut
  let entry = {}

  /**
   * 1. From `.vuepress/theme` directory.
   */
  if (
    !ignoreLocal
    && !fs.existsSync(theme)
    && fs.existsSync(localThemePath)
    && fs.readdirSync(localThemePath).length > 0
  ) {
    path = localThemePath
    name = shortcut = 'local'
    logger.tip(`Apply local theme at ${chalk.gray(path)}...`)

    /**
     * 2. From deps or custom local path.
     *    - vuepress-plugin-foo
     *    - /path/to/a-theme/index.js
     */
  } else if (isString(theme)) {
    /**
     * To let theme resolver get the correct theme name.
     */
    if (theme.endsWith('/index.js')) {
      theme = theme.replace(/\/index\.js$/, '')
    }

    const resolved = resolver.resolve(theme, sourceDir)
    if (resolved.entry === null) {
github vuejs / vuepress / packages / @vuepress / core / lib / node / loadTheme.js View on Github external
'[vuepress] You must specify a theme, or create a local custom theme. \n'
        + 'For more details, refer to https://vuepress.vuejs.org/guide/custom-themes.html#custom-themes. \n'
    )
  }

  let applyTip = `Apply theme ${chalk.magenta(theme.name)}`
  theme.entry.name = '@vuepress/internal-theme-entry-file'

  let parentTheme = {}
  if (theme.entry.extend) {
    parentTheme = resolveTheme(ctx, themeResolver, true, theme.entry.extend)
    parentTheme.entry.name = '@vuepress/internal-parent-theme-entry-file'
    applyTip += chalk.gray(` (extends ${chalk.magenta(parentTheme.name)})`)
  }

  logger.tip(applyTip + ' ...')

  logger.debug('theme', theme.name, theme.path)
  logger.debug('parentTheme', parentTheme.name, parentTheme.path)
  return new ThemeAPI(theme, parentTheme)
}
github appcelerator / docs-devkit / packages / vuepress / vuepress-plugin-versioning / index.js View on Github external
}

              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 vuejs / vuepress / packages / @vuepress / core / lib / node / webpack / createBaseConfig.js View on Github external
.extensions
      .merge(['.js', '.jsx', '.vue', '.json', '.styl'])
      .end()
    .modules
      .merge(modulePaths)

  config.resolveLoader
    .set('symlinks', true)
    .modules
      .merge(modulePaths)

  config.module
    .noParse(/^(vue|vue-router|vuex|vuex-router-sync)$/)

  if (cache === false) {
    logger.tip('Clean cache...\n')
    fs.emptyDirSync(cacheDirectory)
  }

  const finalCacheIdentifier = cacheIdentifier + `isServer:${isServer}`

  function applyVuePipeline (rule) {
    rule
      .use('cache-loader')
        .loader('cache-loader')
        .options({
          cacheDirectory,
          cacheIdentifier: finalCacheIdentifier
        })

    rule
      .use('vue-loader')