Skip to content

Commit

Permalink
chore: plugin usage log
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Dec 2, 2018
1 parent c6764e2 commit d594ce6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/@vuepress/core/lib/plugin-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const { PLUGIN_OPTION_MAP } = require('./constants')
const {
moduleResolver: { getPluginResolver },
datatypes: { assertTypes, isPlainObject },
env: { debug },
logger, chalk
} = require('@vuepress/shared-utils')

Expand Down Expand Up @@ -210,13 +209,7 @@ module.exports = class PluginAPI {
alias
}) {
const isInternalPlugin = pluginName.startsWith('@vuepress/internal-')
if (!isInternalPlugin || debug) {
logger.tip(
shortcut
? `Apply plugin ${chalk.magenta(shortcut)} ${chalk.gray(`(i.e. "${pluginName}")`)} ...`
: `Apply plugin ${chalk.magenta(pluginName)} ...`
)
}
logger[isInternalPlugin ? 'debug' : 'tip'](pluginLog(pluginName, shortcut))

this
.registerOption(PLUGIN_OPTION_MAP.READY.key, ready, pluginName)
Expand All @@ -238,3 +231,9 @@ module.exports = class PluginAPI {
.registerOption(PLUGIN_OPTION_MAP.ALIAS.key, alias, pluginName)
}
}

function pluginLog (name, shortcut) {
return shortcut
? `Apply plugin ${chalk.magenta(shortcut)} ${chalk.gray(`(i.e. "${name}")`)} ...`
: `Apply plugin ${chalk.magenta(name)} ...`
}

0 comments on commit d594ce6

Please sign in to comment.