1.0.0 • Published 1 year ago
creo-bin v1.0.0
creo-bin
- 创建一个名称为creo的bin指令。用于脚本执行。
脚本执行取根目录中的creo-bin.runtime.js文件中的导出函数
参数
// package.json
"scripts": {
"dev:app": "creo vue ",
}
// creo-bin.runtime.js
module.exports = function () {
....
/* your other code */
};
// eg
const concurrently = require('concurrently');
module.exports = function () {
const argvArr = process.argv.slice(2);
const argvStr = argvArr.join(' ');
if (argvArr.includes('docsify')) {
const { result } = concurrently([
{ command: 'gulp docs', name: 'gulp docs' },
{ command: argvStr, name: argvStr }
]);
result.then(
() => {
console.log('concurrently was finished successfully');
process.exit(0);
},
(err) => {
console.error('concurrently was finished with error');
console.error(err);
process.exit(1);
}
);
return;
}
};
1.0.0
1 year ago