Files
next-ai-draw-io/packages/mcp-server/scripts/copy-assets.mjs
T
dayuan.jiang f52f95025f refactor(mcp-server): move the preview page into src/preview
The 580-line page template in http-server.ts becomes index.html,
preview.css and preview.js, copied to dist/preview by the build and
filled at request time. The rendered page is unchanged apart from the
session id and draw.io origin now coming from a small config script.
Biome skips the folder because of the {{placeholders}}, as it never
linted the old template string either.
2026-10-04 06:46:09 +09:00

23 lines
830 B
JavaScript

// Copy non-TypeScript assets into dist/ after tsc, so they ship in the npm
// package ("files": ["dist"]).
import { cpSync, mkdirSync, readdirSync } from "node:fs"
import { dirname, join } from "node:path"
import { fileURLToPath } from "node:url"
const pkg = join(dirname(fileURLToPath(import.meta.url)), "..")
// Shape library docs live at the repository root, shared with the web app
const libSrc = join(pkg, "../../docs/shape-libraries")
const libDest = join(pkg, "dist/shape-libraries")
mkdirSync(libDest, { recursive: true })
for (const file of readdirSync(libSrc)) {
if (file.endsWith(".md") && file !== "README.md") {
cpSync(join(libSrc, file), join(libDest, file))
}
}
// Browser preview page (HTML, CSS and script)
cpSync(join(pkg, "src/preview"), join(pkg, "dist/preview"), {
recursive: true,
})