代码拉取完成,页面将自动刷新
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);
}),
),
)();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。