修复打包问题

This commit is contained in:
ACT丶流星雨 2026-04-04 20:00:28 +08:00
parent cdad1d50c0
commit c3aa03f60e
3 changed files with 10 additions and 22 deletions

View File

@ -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

View File

@ -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 = [

View File

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