@yunlong.syl/mini-program-cli
Version:
小程序初始化模版,可初始化 微信/支付宝 小程序
38 lines (34 loc) • 665 B
JavaScript
const chalk = require('chalk')
const {
exec,
} = require('child_process')
const shell = (order, option = {}) => {
const pro = new Promise((reslove, reject) => {
exec(order, option, (err, stdout) => {
if (err) {
reject(err)
} else {
reslove(stdout)
}
})
})
return pro
}
const log = {
ok: text => {
console.log(`${chalk.green('success: ')}${chalk.cyan(text)}`)
},
error: text => {
console.log(`${chalk.red(`error: ${text}`)}`)
},
warn: text => {
console.log(`${chalk.yellow(`message: ${text}`)}`)
},
sysErr: error => {
console.error(error)
},
}
module.exports = {
shell,
log,
}