修正 dev:all 摘要表输出时序

改用无引号纯文本表格显示启动服务和实际地址。

等待 Tauri Running DevCommand 后再打印摘要。

补充启动器输出转发、回归测试和开发运维说明。
This commit is contained in:
2026-10-01 19:03:52 +08:00
parent e9b3e2b531
commit c911a338f9
5 changed files with 113 additions and 11 deletions
@@ -568,7 +568,7 @@ function spawnChild(command, args, options, spawnImpl = spawn) {
// POSIX 下让每个长驻服务拥有独立进程组,退出时可以连同 npm、
// Node、Cargo 及其子进程一起清理,避免残留订阅任务持续刷日志。
detached: isPosix,
stdio: 'inherit',
stdio: options.stdio ?? 'inherit',
});
const lifecycle = {
failure: null,
@@ -33,6 +33,7 @@ const tauriCliPath = resolve(repoRoot, 'node_modules/@tauri-apps/cli/tauri.js');
const AGC_DESIGN_DEBUG_ENV = 'GENARRATIVE_AGC_DESIGN_DEBUG';
const designDebugEnabled =
process.env[AGC_DESIGN_DEBUG_ENV]?.trim() === '0' ? '0' : '1';
const tauriDevReadyMarker = '[ai-game-creator-shell] Tauri DevCommand 已启动';
function buildTauriArguments(argv, devUrl = readAgcDevEndpoint().url) {
const args = [...argv];
@@ -103,11 +104,27 @@ function prepareBundledResourcesBeforeTauri(
}
function spawnTauriCli(argv, { env = process.env } = {}) {
return spawnChild(process.execPath, [tauriCliPath, ...argv], {
const child = spawnChild(process.execPath, [tauriCliPath, ...argv], {
cwd: appRoot,
env,
shell: false,
stdio: ['inherit', 'pipe', 'pipe'],
});
let output = '';
let announced = false;
const forwardOutput = (stream, target) => {
stream?.on('data', (chunk) => {
target.write(chunk);
output = `${output}${chunk.toString()}`.slice(-4096);
if (!announced && output.includes('Running DevCommand')) {
announced = true;
console.log(tauriDevReadyMarker);
}
});
};
forwardOutput(child.stdout, process.stdout);
forwardOutput(child.stderr, process.stderr);
return child;
}
/// Tauri dev 的 Cargo 直接继承启动器环境,用户级 / 仓库级 Cargo 配置里的