mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-27 23:50:28 +00:00
Rename remaining Pi-shaped agent surfaces to OpenClaw agent runtime names, delete obsolete Pi docs and package graph checks, and add the third-party notice for incorporated code.
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
#!/usr/bin/env tsx
|
|
/**
|
|
* Copy export-html templates from src to dist
|
|
*/
|
|
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { ensureDirectory, logVerboseCopy, resolveBuildCopyContext } from "./lib/copy-assets.ts";
|
|
|
|
const context = resolveBuildCopyContext(import.meta.url);
|
|
|
|
const exportHtmlSrcDir = path.join(
|
|
context.projectRoot,
|
|
"src",
|
|
"auto-reply",
|
|
"reply",
|
|
"export-html",
|
|
);
|
|
const exportHtmlDistDir = path.join(
|
|
context.projectRoot,
|
|
"dist",
|
|
"auto-reply",
|
|
"reply",
|
|
"export-html",
|
|
);
|
|
|
|
function copyExportHtmlTemplates() {
|
|
if (!fs.existsSync(exportHtmlSrcDir)) {
|
|
console.warn(`${context.prefix} Source directory not found:`, exportHtmlSrcDir);
|
|
return;
|
|
}
|
|
|
|
fs.rmSync(exportHtmlDistDir, { recursive: true, force: true });
|
|
ensureDirectory(exportHtmlDistDir);
|
|
let copiedCount = 0;
|
|
|
|
const copyDir = (srcDir: string, distDir: string, relativePrefix = "") => {
|
|
ensureDirectory(distDir);
|
|
for (const file of fs.readdirSync(srcDir)) {
|
|
const srcFile = path.join(srcDir, file);
|
|
const distFile = path.join(distDir, file);
|
|
const relativeName = path.join(relativePrefix, file);
|
|
if (file.endsWith(".test.ts")) {
|
|
continue;
|
|
}
|
|
if (fs.statSync(srcFile).isDirectory()) {
|
|
copyDir(srcFile, distFile, relativeName);
|
|
continue;
|
|
}
|
|
fs.copyFileSync(srcFile, distFile);
|
|
copiedCount += 1;
|
|
logVerboseCopy(context, `Copied ${relativeName}`);
|
|
}
|
|
};
|
|
|
|
copyDir(exportHtmlSrcDir, exportHtmlDistDir);
|
|
|
|
console.log(`${context.prefix} Copied ${copiedCount} export-html assets.`);
|
|
}
|
|
|
|
copyExportHtmlTemplates();
|