mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-05 01:07:56 +08:00
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.
23 lines
830 B
JavaScript
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,
|
|
})
|