From 3befb0e2576458214d96b298e1b787b3e7425f96 Mon Sep 17 00:00:00 2001 From: john Date: Mon, 6 Jul 2026 17:06:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(build):=20runtime=20=E6=B8=85=E7=90=86?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=97=B6=E5=9B=9E=E9=80=80=20shell=20rm=20-r?= =?UTF-8?q?f?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免 macOS 上 pnpm node_modules 树导致 ENOTEMPTY 阻断发布构建。 Co-authored-by: Cursor --- scripts/build-portal-runtime.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/build-portal-runtime.mjs b/scripts/build-portal-runtime.mjs index 0ea8ddb..d7cfa86 100755 --- a/scripts/build-portal-runtime.mjs +++ b/scripts/build-portal-runtime.mjs @@ -65,7 +65,13 @@ async function exists(targetPath) { } async function remove(targetPath) { - await fs.rm(targetPath, { recursive: true, force: true }); + if (!(await exists(targetPath))) return; + try { + await fs.rm(targetPath, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); + } catch (error) { + if (error?.code !== 'ENOTEMPTY' && error?.code !== 'EBUSY') throw error; + await run('rm', ['-rf', targetPath]); + } } async function copyDir(source, target) {