From 6fbddbe77c115b1c278d219634a310b10964a540 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Thu, 21 May 2026 19:49:50 +0800 Subject: [PATCH] fix: run app publish in disposable eeui container --- electron/build.js | 19 +++++++++++++++---- resources/mobile | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/electron/build.js b/electron/build.js index ac63319ea..8f293ddc7 100644 --- a/electron/build.js +++ b/electron/build.js @@ -25,6 +25,8 @@ const architectures = ["arm64", "x64"]; let buildChecked = false, updaterChecked = false; +const shellQuote = (value) => `'${String(value).replace(/'/g, `'\\''`)}'`; + /** * 检测并下载更新器 */ @@ -568,8 +570,8 @@ async function startBuild(data) { // if (data.id === 'app') { const eeuiDir = path.resolve(__dirname, "../resources/mobile"); - const eeuiRun = `docker run --rm -v ${eeuiDir}:/work -w /work kuaifan/eeui-cli:0.0.1` const publicDir = path.resolve(__dirname, "../resources/mobile/src/public"); + const containerName = `dootask-eeui-${Date.now()}-${process.pid}`; fse.removeSync(publicDir) fse.copySync(electronDir, publicDir) if (argv[3] === "publish") { @@ -587,10 +589,19 @@ async function startBuild(data) { fs.writeFileSync(xcconfigFile, xcconfigResult, 'utf8') } if (['build', 'publish'].includes(argv[3])) { - if (!fs.existsSync(path.resolve(eeuiDir, "node_modules"))) { - child_process.execSync(`${eeuiRun} npm install`, {stdio: "inherit", cwd: "resources/mobile"}); + child_process.execSync( + `docker run -d --name ${containerName} -v ${shellQuote(eeuiDir)}:/work -w /work kuaifan/eeui-cli:0.0.1 sleep infinity`, + {stdio: "ignore", cwd: "resources/mobile"} + ); + try { + if (!fs.existsSync(path.resolve(eeuiDir, "node_modules"))) { + child_process.execSync(`docker exec ${containerName} npm install`, {stdio: "inherit", cwd: "resources/mobile"}); + } + child_process.execSync(`docker exec ${containerName} node /work/scripts/patch-eeui-build.js`, {stdio: "inherit", cwd: "resources/mobile"}); + child_process.execSync(`docker exec ${containerName} eeui build --simple`, {stdio: "inherit", cwd: "resources/mobile"}); + } finally { + child_process.execSync(`docker rm -f ${containerName}`, {stdio: "ignore", cwd: "resources/mobile"}); } - child_process.execSync(`${eeuiRun} eeui build --simple`, {stdio: "inherit", cwd: "resources/mobile"}); } else { [ path.resolve(publicDir, "../../platforms/ios/eeuiApp/bundlejs/eeui/public"), diff --git a/resources/mobile b/resources/mobile index 4e8ee678b..fb65bcd7e 160000 --- a/resources/mobile +++ b/resources/mobile @@ -1 +1 @@ -Subproject commit 4e8ee678b312dea2d578922ee873d6801335a045 +Subproject commit fb65bcd7e4c1dd4eb7d9df264af6792afacee563