fix: stabilize docs demo runtime routing

This commit is contained in:
3252a8
2026-05-31 00:25:23 +03:00
parent cf3af17243
commit 19f7daff6c
5 changed files with 21 additions and 27 deletions
+11 -10
View File
@@ -1,11 +1,12 @@
# Cloudflare Pages rewrites for non-materialized static docs demo runtime routes.
# Use the directory entrypoint so Pages clean URLs do not loop between app.html and app.
/demo/runtime/home/* /demo/runtime/app/ 200
/demo/runtime/install/* /demo/runtime/app/ 200
/demo/runtime/trial/* /demo/runtime/app/ 200
/demo/runtime/invite/* /demo/runtime/app/ 200
/demo/runtime/devices/* /demo/runtime/app/ 200
/demo/runtime/support/* /demo/runtime/app/ 200
/demo/runtime/settings/* /demo/runtime/app/ 200
/demo/runtime/login/* /demo/runtime/app/ 200
/demo/runtime/admin/* /demo/runtime/app/ 200
# Use the generated directory index instead of app.html so Pages clean URLs do not
# loop between extensionless and .html variants.
/demo/runtime/home/* /demo/runtime/app/index.html 200
/demo/runtime/install/* /demo/runtime/app/index.html 200
/demo/runtime/trial/* /demo/runtime/app/index.html 200
/demo/runtime/invite/* /demo/runtime/app/index.html 200
/demo/runtime/devices/* /demo/runtime/app/index.html 200
/demo/runtime/support/* /demo/runtime/app/index.html 200
/demo/runtime/settings/* /demo/runtime/app/index.html 200
/demo/runtime/login/* /demo/runtime/app/index.html 200
/demo/runtime/admin/* /demo/runtime/app/index.html 200
+2 -1
View File
@@ -191,6 +191,7 @@ await runNpm(["--prefix", frontendRoot, "run", "build:docs-demo"]);
await rm(runtimeDir, { recursive: true, force: true });
await mkdir(runtimeDir, { recursive: true });
await mkdir(path.join(runtimeDir, "app"), { recursive: true });
const html = await appHtml();
@@ -204,7 +205,7 @@ await Promise.all([
path.join(runtimeDir, "default-brand"),
),
copyDirectory(themesDir, path.join(runtimeDir, "themes"), copyThemeFile),
writeFile(path.join(runtimeDir, "app.html"), html, "utf8"),
writeFile(path.join(runtimeDir, "app", "index.html"), html, "utf8"),
installGuidesConfigPayload().then((payload) =>
writeFile(
path.join(runtimeDir, "subscription-guides-config.json"),
@@ -19,7 +19,13 @@ async function copyHtml(source, route) {
}
const demoShell = path.join(distRoot, "demo", "index.html");
const runtimeApp = path.join(distRoot, "demo", "runtime", "app.html");
const runtimeApp = path.join(
distRoot,
"demo",
"runtime",
"app",
"index.html",
);
for (const route of demoRoutes) {
await copyHtml(demoShell, route);
@@ -1,14 +0,0 @@
import { readFile } from "node:fs/promises";
import path from "node:path";
const runtimeAppHtml = path.join(process.cwd(), "public", "demo", "runtime", "app.html");
export const prerender = true;
export async function GET() {
return new Response(await readFile(runtimeAppHtml, "utf8"), {
headers: {
"Content-Type": "text/html; charset=utf-8",
},
});
}