From c3aa03f60ef6098b97197ddd6f2a19fbfec747f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ACT=E4=B8=B6=E6=B5=81=E6=98=9F=E9=9B=A8?= <1340145680@qq.com> Date: Sat, 4 Apr 2026 20:00:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=93=E5=8C=85=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 12 ++++++------ scripts/build.ts | 12 ------------ src/routes/setting/about/downloadApp.ts | 8 ++++---- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 803768c..5c7cc93 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,8 +33,8 @@ jobs: - name: Install sharp platform binaries run: | - npm install --os=win32 --cpu=x64 sharp - npm install --os=win32 --cpu=arm64 sharp + npm install --os=win32 --cpu=x64 --legacy-peer-deps sharp + npm install --os=win32 --cpu=arm64 --legacy-peer-deps sharp - name: Build Windows installer run: yarn dist:win @@ -70,8 +70,8 @@ jobs: - name: Install sharp platform binaries run: | - npm install --os=darwin --cpu=x64 sharp - npm install --os=darwin --cpu=arm64 sharp + npm install --os=darwin --cpu=x64 --legacy-peer-deps sharp + npm install --os=darwin --cpu=arm64 --legacy-peer-deps sharp - name: Build macOS installer run: yarn dist:mac @@ -107,8 +107,8 @@ jobs: - name: Install sharp platform binaries run: | - npm install --os=linux --cpu=x64 sharp - npm install --os=linux --cpu=arm64 sharp + npm install --os=linux --cpu=x64 --legacy-peer-deps sharp + npm install --os=linux --cpu=arm64 --legacy-peer-deps sharp - name: Build Linux installer run: yarn dist:linux diff --git a/scripts/build.ts b/scripts/build.ts index 097d927..60d2bf7 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -7,18 +7,6 @@ if (!process.env.NODE_ENV) { process.env.NODE_ENV = "prod"; } -// 自动创建 env 目录和环境变量文件(.gitignore 可能忽略了这些文件) -const envDir = path.resolve("env"); -const envFile = path.join(envDir, `.env.${process.env.NODE_ENV}`); -if (!fs.existsSync(envDir)) { - fs.mkdirSync(envDir, { recursive: true }); -} -if (!fs.existsSync(envFile)) { - const defaultEnv = `NODE_ENV=${process.env.NODE_ENV}\nPORT=10588\nOSSURL=http://127.0.0.1:10588/\n`; - fs.writeFileSync(envFile, defaultEnv, "utf8"); - console.log(`📄 已自动创建环境变量文件: ${envFile}`); -} - const pkg = JSON.parse(fs.readFileSync(path.resolve("package.json"), "utf8")); const external = [ diff --git a/src/routes/setting/about/downloadApp.ts b/src/routes/setting/about/downloadApp.ts index 267269d..876ccce 100644 --- a/src/routes/setting/about/downloadApp.ts +++ b/src/routes/setting/about/downloadApp.ts @@ -43,19 +43,19 @@ export default router.post( await compressing.zip.uncompress(`${rootDir}/latest.zip`, rootDir); const tempServerPath = u.getPath(["temp", "serve"]); if (fs.existsSync(tempServerPath)) { - fs.cpSync(tempServerPath, u.getPath(["serve"]), { recursive: true }); + fs.cpSync(tempServerPath, u.getPath(["serve"]), { recursive: true, force: true }); } const webPath = u.getPath(["temp", "web"]); if (fs.existsSync(webPath)) { - fs.cpSync(webPath, u.getPath(["web"]), { recursive: true }); + fs.cpSync(webPath, u.getPath(["web"]), { recursive: true, force: true }); } const tempSkillsPath = u.getPath(["temp", "skills"]); if (fs.existsSync(tempSkillsPath)) { - fs.cpSync(tempSkillsPath, u.getPath(["skills"]), { recursive: true }); + fs.cpSync(tempSkillsPath, u.getPath(["skills"]), { recursive: true, force: true }); } const tempModelsPath = u.getPath(["temp", "models"]); if (fs.existsSync(tempModelsPath)) { - fs.cpSync(tempModelsPath, u.getPath(["models"]), { recursive: true }); + fs.cpSync(tempModelsPath, u.getPath(["models"]), { recursive: true, force: true }); } fs.rmSync(rootDir, { recursive: true, force: true }); res.status(200).send(success("更新成功,5秒后重启"));