import { cpSync, existsSync, rmSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; const here = path.dirname(fileURLToPath(import.meta.url)); const source = path.resolve(here, "../../web/dist"); const target = path.resolve(here, "../dist"); if (!existsSync(source)) { console.error("未找到 web/dist,请先在 web/ 目录执行 pnpm build"); process.exit(1); } rmSync(target, { recursive: true, force: true }); cpSync(source, target, { recursive: true }); console.log(`已复制前端产物:${source} -> ${target}`);