优化代码结构

This commit is contained in:
gs committed 2026-09-26 02:11:19 +08:00
1 parent 8c7a9040d2
commit cbcd6b4c7f
97 files changed
+4350 -1183

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const webDir = path.resolve(__dirname, '..');
const distDir = path.resolve(webDir, 'dist');
const rootDir = path.resolve(webDir, '../..');
const targets = [
path.resolve(rootDir, 'deploy/artifacts/web')
];
if (!fs.existsSync(distDir)) {
console.error(`[copy-artifacts] 错误: 前端 dist 目录不存在: ${distDir}`);
process.exit(1);
}
for (const targetDir of targets) {
try {
fs.mkdirSync(targetDir, { recursive: true });
// 清理旧产物,避免遗留老旧的静态资源 hash 文件
fs.rmSync(targetDir, { recursive: true, force: true });
fs.mkdirSync(targetDir, { recursive: true });
fs.cpSync(distDir, targetDir, { recursive: true });
console.log(`[copy-artifacts] 成功复制前端构建产物到: ${targetDir}`);
} catch (err) {
console.error(`[copy-artifacts] 复制到 ${targetDir} 失败:`, err);
process.exit(1);
}
}