mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 14:27:26 +00:00
docs: rebuild journeys guides and Studio
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { mkdirSync, writeFileSync } from "node:fs";
|
||||
import { dirname, relative, resolve, sep } from "node:path";
|
||||
|
||||
import { bundleToSingleHtml } from "../../packages/core/src/compiler/index.ts";
|
||||
|
||||
const [projectArg, outputArg] = process.argv.slice(2);
|
||||
|
||||
if (!projectArg || !outputArg) {
|
||||
console.error("Usage: bun scripts/docs/bundle-live-reference.mjs <project-dir> <output.html>");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const projectDir = resolve(projectArg);
|
||||
const outputPath = resolve(outputArg);
|
||||
const bundledHtml = await bundleToSingleHtml(projectDir, { runtime: "inline" });
|
||||
const relativeProjectRoot = relative(dirname(outputPath), projectDir).split(sep).join("/");
|
||||
const baseHref = relativeProjectRoot ? `${relativeProjectRoot}/` : "./";
|
||||
const html = bundledHtml
|
||||
.replace("<head>", `<head>\n <base href="${baseHref}">`)
|
||||
.replace(/[ \t]+$/gm, "");
|
||||
|
||||
mkdirSync(dirname(outputPath), { recursive: true });
|
||||
writeFileSync(outputPath, html);
|
||||
console.log(`${outputPath} (${Buffer.byteLength(html).toLocaleString()} bytes)`);
|
||||
Reference in New Issue
Block a user