mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-20 14:19:59 -06:00
26 lines
578 B
JavaScript
26 lines
578 B
JavaScript
const chalk = require('chalk')
|
|
|
|
const format = (label, msg) => {
|
|
return msg.split('\n').map((line, i) => {
|
|
return i === 0
|
|
? `\n ${label} ${line}`
|
|
: ` ${line}`
|
|
}).join('\n') + '\n'
|
|
}
|
|
|
|
exports.success = msg => {
|
|
console.log(format(chalk.bgGreen(' OK '), chalk.green(msg)))
|
|
}
|
|
|
|
exports.warn = msg => {
|
|
console.warn(format(chalk.bgYellow(chalk.black(' WARN ')), chalk.yellow(msg)))
|
|
}
|
|
|
|
exports.error = msg => {
|
|
console.error(format(chalk.bgRed(' ERROR '), chalk.red(msg)))
|
|
if (msg instanceof Error) {
|
|
console.error(msg.stack)
|
|
}
|
|
process.exit(1)
|
|
}
|