1 Star 1 Fork 0

Bytedance Inc./mona

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.js 1.76 KB
一键复制 编辑 原始数据 按行查看 历史
fengbo.lucky 提交于 2024-03-14 14:32 . chore: merge plugin
const spawn = require('child_process').spawn;
const pkgs = {
mona: '@bytedance/mona',
cli: '@bytedance/mona-cli',
mini: '@bytedance/mona-client-mini',
web: '@bytedance/mona-client-web',
max: '@bytedance/mona-client-max',
// plugin: '@bytedance/mona-client-plugin',
events: '@bytedance/mona-plugin-events',
runtime: '@bytedance/mona-runtime',
shared: '@bytedance/mona-shared',
build: '@bytedance/mona-build',
service: '@bytedance/mona-service',
manager: '@bytedance/mona-manager',
'cli-commands': '@bytedance/mona-cli-commands',
'service-commands': '@bytedance/mona-service-commands',
'target-web': '@bytedance/mona-service-target-web',
'target-mini': '@bytedance/mona-service-target-mini',
'target-lynx': '@bytedance/mona-service-target-lynx',
'manager-shared': '@bytedance/mona-manager-plugins-shared'
};
const rawTargets = process.argv.slice(2);
const startIndex = rawTargets.indexOf('-s');
const isStart = startIndex !== -1;
if (isStart) {
rawTargets.splice(startIndex, 1);
}
const targets = rawTargets.map(key => pkgs[key]).filter(r => !!r);
console.log(`now ${isStart ? 'start' : 'build'} for`, targets);
console.log('');
const cmds = targets.map(t => `yarn workspace ${t} ${isStart ? 'start' : 'build'}`);
// pipe func
const pipe = funcs => input =>
funcs.reduce((prev, cur) => i => {
const res = prev(i);
const isPromise = typeof res.then === 'function';
if (isPromise) {
return res.then(r => cur(r));
} else {
return cur(res);
}
})(input);
pipe(
cmds.map(
cmd => () =>
new Promise((resolve, reject) => {
const parts = cmd.split(/\s+/g);
console.log(cmd);
const result = spawn(parts[0], parts.slice(1), { stdio: 'inherit' });
result.on('exit', resolve);
}),
),
)();
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ByteDance/mona.git
[email protected]:ByteDance/mona.git
ByteDance
mona
mona
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385