From 04b1a9cfde4049be9a38b9832d5289d4a192c883 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 15 五月 2026 16:29:33 +0800
Subject: [PATCH] 加班申请模块和审批流程公共组件
---
multiple/multiple-build.js | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/multiple/multiple-build.js b/multiple/multiple-build.js
index 8e078e1..d87b333 100644
--- a/multiple/multiple-build.js
+++ b/multiple/multiple-build.js
@@ -24,6 +24,19 @@
const envFilePath = path.join(process.cwd(), '.env.production.local');
+async function copyFileWithOverwrite(src, dest) {
+ await fs.mkdir(path.dirname(dest), { recursive: true });
+ if (fsSync.existsSync(dest)) {
+ try {
+ await fs.chmod(dest, 0o666);
+ } catch {
+ // Ignore chmod failure and try delete directly.
+ }
+ await fs.rm(dest, { force: true });
+ }
+ await fs.copyFile(src, dest);
+}
+
try {
// 1锔忊儯 鐢熸垚 .env
console.log("=======鐢熸垚.env=======");
@@ -41,9 +54,8 @@
const backupFile = path.join(replacePath, config[key]);
const replaceFile = path.join(resourcePath, companyMap[key]);
- await fs.mkdir(path.dirname(backupFile), { recursive: true });
- await fs.copyFile(originFile, backupFile);
- await fs.copyFile(replaceFile, originFile);
+ await copyFileWithOverwrite(originFile, backupFile);
+ await copyFileWithOverwrite(replaceFile, originFile);
}
console.log("=====寮�濮嬫墦鍖�======");
@@ -66,7 +78,7 @@
const originFile = path.join(rootPath, config[key]);
const backupFile = path.join(replacePath, config[key]);
- await fs.copyFile(backupFile, originFile);
+ await copyFileWithOverwrite(backupFile, originFile);
}
await fs.rm(replacePath, { recursive: true, force: true });
console.log(`馃棏锔� 宸插垹闄� ${replacePath}`);
--
Gitblit v1.9.3