UNPKG

gub

Version:

> 接入成本极低,快速从原有项目(可运行项目)中clone出新项目,并重写package.json,安装依赖

23 lines (16 loc) 640 B
const chalk = require("chalk") const moment = require("moment") const pkg = require("../package.json") const log = console.log const getCurDate = () => moment().format("YYYY-MM-DD hh:mm:ss") const getMessage = (type, msg, color = "yellow") => log( chalk[color]( `【${pkg.name.toUpperCase()} ${getCurDate()}${type.toUpperCase()}: ` + msg ) ) exports.success = msg => getMessage("success", msg, "green") exports.error = msg => getMessage("error", msg, "red") exports.info = msg => getMessage("info", msg, "yellow") exports.flat = (msg, color = "yellow") => log(chalk[color](msg))