1 Star 0 Fork 91

同名自定义/cnchar

forked from theajack/cnchar 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
publish.js 2.21 KB
一键复制 编辑 原始数据 按行查看 历史
theajack 提交于 2021-12-17 12:03 . feat: 3.0.5
const {exec, Packages} = require('./tool');
const {plugins, allPackage, mainPackage, types, utils} = Packages;
// plugins 'main' 'npm' 'types' 可选
// npm run publish: 默认build 全部
// npm run publish main poly npm: build三个
async function main () {
const publish = 'npm publish ';
const publishPackage = `${publish}npm/packages/`;
const publishAll = `${publishPackage}cnchar-all`;
const publishTypes = `${publishPackage}cnchar-types`;
const publishMain = `${publishPackage}cnchar`;
let cmds = [];
let cmdConsole = [];
const packages = process.argv.slice(2);
packages.forEach(package => {
if (plugins.includes(package) || utils.includes(package)) {
cmds.push(`${publishPackage}${package}`);
cmdConsole.push(package);
} else if (package === mainPackage) {
cmds.push(publishMain);
cmdConsole.push(mainPackage);
} else if (package === allPackage) {
cmds.push(publishAll);
cmdConsole.push(allPackage);
} else if (package === types) {
cmds.push(publishTypes);
cmdConsole.push(types);
}
});
if (cmds.length === 0) {
cmds = [
publishTypes,
publishMain,
...plugins.map(plugin => `${publishPackage}${plugin}`),
publishAll,
...utils.map(util => `${publishPackage}${util}`)
];
cmdConsole = [
types,
mainPackage,
...plugins,
allPackage,
...utils
];
}
console.log(`Start Publish... [0/${cmds.length}]`);
const errorList = [];
for (let i = 0; i < cmds.length; i++) {
const {success, stderr} = await exec(cmds[i]); {
if (success) {
console.log(`${cmdConsole[i]} publish success. [${i + 1}/${cmds.length}]`);
} else {
console.log(stderr);
console.log(`${cmdConsole[i]} publish fail!. [${i + 1}/${cmds.length}]`);
errorList.push(cmdConsole[i]);
}
}
}
console.log('Finished!');
if (errorList.length > 0) {
console.log(`Fail Items: ${cmdConsole.toString()}`);
}
}
main();
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/LYTB/cnchar.git
git@gitee.com:LYTB/cnchar.git
LYTB
cnchar
cnchar
master

搜索帮助