diff --git a/wai-server/copy-to-dist.js b/wai-server/copy-to-dist.js index 00baf6d..a744646 100644 --- a/wai-server/copy-to-dist.js +++ b/wai-server/copy-to-dist.js @@ -21,6 +21,9 @@ async function copyFiles() { try { // 确保dist目录存在 await fs.ensureDir(distPath); + // 清空dist目录中的所有内容 + await fs.emptyDir(distPath); + console.log('🧹 ', distPath); // 遍历并复制每一项 for (const item of copyItems) { @@ -29,14 +32,14 @@ async function copyFiles() { if (await fs.pathExists(srcPath)) { await fs.copy(srcPath, destPath, { overwrite: true }); - console.log(`✅ 已复制: ${item} → ${destPath}`); + console.log(`✅ ${item} → ${destPath}`); } else { - console.warn(`⚠️ 路径不存在: ${srcPath}`); + console.warn(`⚠️ ${srcPath}`); } } - console.log('🎉 所有文件复制完成!'); + console.log('🎉 Done'); } catch (err) { - console.error('❌ 复制失败:', err); + console.error('❌ ', err); process.exit(1); } }