9b30f681c6
- React+antd+zustand,注册表驱动路由/菜单/权限 - Tauri 桌面壳、后端托管 SPA、跨标签页消息队列
30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
// 构建后把 console 的 dist/ 产物复制到后端静态目录 ../src/pineagents/console,
|
||
// 替换旧资源。由 console/package.json 的 build 脚本在每次编译完成后调用。
|
||
import { cp, mkdir, rm } from "node:fs/promises";
|
||
import { access } from "node:fs/promises";
|
||
import { fileURLToPath } from "node:url";
|
||
import path from "node:path";
|
||
|
||
const here = path.dirname(fileURLToPath(import.meta.url));
|
||
const distDir = path.resolve(here, "../dist");
|
||
const targetDir = path.resolve(here, "../../src/pineagents/console");
|
||
|
||
async function main() {
|
||
try {
|
||
await access(distDir);
|
||
} catch {
|
||
console.error(`[copy-console] dist 不存在: ${distDir}`);
|
||
process.exit(1);
|
||
}
|
||
|
||
await rm(targetDir, { recursive: true, force: true });
|
||
await mkdir(targetDir, { recursive: true });
|
||
await cp(distDir, targetDir, { recursive: true });
|
||
console.log(`[copy-console] 已复制 ${distDir} -> ${targetDir}`);
|
||
}
|
||
|
||
main().catch((err) => {
|
||
console.error("[copy-console] 复制失败:", err);
|
||
process.exit(1);
|
||
});
|