mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-08 02:37:46 +08:00
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.
This commit is contained in:
@@ -3,7 +3,13 @@
|
||||
// Run after `npm run build`.
|
||||
import { execSync } from "node:child_process"
|
||||
|
||||
const REQUIRED = ["dist/index.js", "dist/shape-libraries/aws4.md"]
|
||||
const REQUIRED = [
|
||||
"dist/index.js",
|
||||
"dist/shape-libraries/aws4.md",
|
||||
"dist/preview/index.html",
|
||||
"dist/preview/preview.css",
|
||||
"dist/preview/preview.js",
|
||||
]
|
||||
|
||||
const [pack] = JSON.parse(
|
||||
execSync("npm pack --dry-run --json", { encoding: "utf8" }),
|
||||
|
||||
@@ -15,3 +15,8 @@ for (const file of readdirSync(libSrc)) {
|
||||
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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user