igroot-builder
Version:
白山——zeus系统前端打包工具
15 lines (12 loc) • 441 B
JavaScript
const chalk = require('chalk')
const notify = {
error: 'red',
warn: 'yellowBright',
info: 'blueBright',
success: 'green'
}
const handle = (type, color) => message => {
console.log(chalk[`bg${color[0].toLocaleUpperCase()}${color.slice(1)}`](` ${chalk.black(type.toLocaleUpperCase())} `) + ' ' + chalk[color](message) + '\n')
}
Object.keys(notify).forEach(type => notify[type] = handle(type, notify[type]))
module.exports = notify