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秒后重启"));