pgy-deploy
Version:
使用ssh2与scp2实现代码发布
31 lines • 898 B
JavaScript
const chalk = require('chalk');
const info = chalk.blue;
const success = chalk.green;
const error = chalk.bold.red;
const warning = chalk.keyword('orange');
module.exports = {
toProjectPath(path) {
const dir = __dirname.replace(/\\/g, "/");
const res = (dir + "/" + path).replace(/\/\//g, "/");
return res;
},
myPrint(str, type = "info") {
switch (type) {
case "info":
console.log(info(str));
break;
case "success":
console.log(success(str));
break;
case "error":
console.log(error(str));
break;
case "warning":
console.log(warning(str));
break;
default:
console.log(info(str));
break;
}
}
};