修复打包问题
This commit is contained in:
parent
cdad1d50c0
commit
c3aa03f60e
12
.github/workflows/release.yml
vendored
12
.github/workflows/release.yml
vendored
@ -33,8 +33,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Install sharp platform binaries
|
- name: Install sharp platform binaries
|
||||||
run: |
|
run: |
|
||||||
npm install --os=win32 --cpu=x64 sharp
|
npm install --os=win32 --cpu=x64 --legacy-peer-deps sharp
|
||||||
npm install --os=win32 --cpu=arm64 sharp
|
npm install --os=win32 --cpu=arm64 --legacy-peer-deps sharp
|
||||||
|
|
||||||
- name: Build Windows installer
|
- name: Build Windows installer
|
||||||
run: yarn dist:win
|
run: yarn dist:win
|
||||||
@ -70,8 +70,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Install sharp platform binaries
|
- name: Install sharp platform binaries
|
||||||
run: |
|
run: |
|
||||||
npm install --os=darwin --cpu=x64 sharp
|
npm install --os=darwin --cpu=x64 --legacy-peer-deps sharp
|
||||||
npm install --os=darwin --cpu=arm64 sharp
|
npm install --os=darwin --cpu=arm64 --legacy-peer-deps sharp
|
||||||
|
|
||||||
- name: Build macOS installer
|
- name: Build macOS installer
|
||||||
run: yarn dist:mac
|
run: yarn dist:mac
|
||||||
@ -107,8 +107,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Install sharp platform binaries
|
- name: Install sharp platform binaries
|
||||||
run: |
|
run: |
|
||||||
npm install --os=linux --cpu=x64 sharp
|
npm install --os=linux --cpu=x64 --legacy-peer-deps sharp
|
||||||
npm install --os=linux --cpu=arm64 sharp
|
npm install --os=linux --cpu=arm64 --legacy-peer-deps sharp
|
||||||
|
|
||||||
- name: Build Linux installer
|
- name: Build Linux installer
|
||||||
run: yarn dist:linux
|
run: yarn dist:linux
|
||||||
|
|||||||
@ -7,18 +7,6 @@ if (!process.env.NODE_ENV) {
|
|||||||
process.env.NODE_ENV = "prod";
|
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 pkg = JSON.parse(fs.readFileSync(path.resolve("package.json"), "utf8"));
|
||||||
|
|
||||||
const external = [
|
const external = [
|
||||||
|
|||||||
@ -43,19 +43,19 @@ export default router.post(
|
|||||||
await compressing.zip.uncompress(`${rootDir}/latest.zip`, rootDir);
|
await compressing.zip.uncompress(`${rootDir}/latest.zip`, rootDir);
|
||||||
const tempServerPath = u.getPath(["temp", "serve"]);
|
const tempServerPath = u.getPath(["temp", "serve"]);
|
||||||
if (fs.existsSync(tempServerPath)) {
|
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"]);
|
const webPath = u.getPath(["temp", "web"]);
|
||||||
if (fs.existsSync(webPath)) {
|
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"]);
|
const tempSkillsPath = u.getPath(["temp", "skills"]);
|
||||||
if (fs.existsSync(tempSkillsPath)) {
|
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"]);
|
const tempModelsPath = u.getPath(["temp", "models"]);
|
||||||
if (fs.existsSync(tempModelsPath)) {
|
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 });
|
fs.rmSync(rootDir, { recursive: true, force: true });
|
||||||
res.status(200).send(success("更新成功,5秒后重启"));
|
res.status(200).send(success("更新成功,5秒后重启"));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user