From 417da231a22c6bc418133f872355712535621ed0 Mon Sep 17 00:00:00 2001 From: Jo Franchetti Date: Mon, 8 Jul 2024 11:31:38 +0100 Subject: [PATCH] fixing build for windows (swap backslash for forward slash in path) (#551) --- reference.page.jsx | 21 ++++++++++++--------- reference_gen/deno.json | 1 - 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/reference.page.jsx b/reference.page.jsx index c023e0b56..100db1357 100644 --- a/reference.page.jsx +++ b/reference.page.jsx @@ -17,19 +17,22 @@ export default function* () { "", ); + const trailingLength = file.path.endsWith("index.html") + ? -"index.html".length + : -".html".length; + + let path = file.path.slice("reference_gen/gen".length, trailingLength); + + // replace slashes for windows + path = path.replace(/\\/g, "/"); + yield { - url: "/api" + - file.path.slice( - "reference_gen/gen".length, - file.path.endsWith("index.html") - ? -"index.html".length - : -".html".length, - ), + url: "/api" + path, title: file.name.slice(0, -".html".length), content, }; } - } catch { - console.warn("⚠️ Reference docs were not generated."); + } catch (ex) { + console.warn("⚠️ Reference docs were not generated." + ex); } } diff --git a/reference_gen/deno.json b/reference_gen/deno.json index a9ffb7246..48f3ef221 100644 --- a/reference_gen/deno.json +++ b/reference_gen/deno.json @@ -16,7 +16,6 @@ "types:deno": "deno run --allow-read --allow-write --allow-run --allow-env --allow-sys deno-docs.ts", "types:node": "deno run --allow-read --allow-write=. --allow-env --allow-sys node-docs.ts", "types": "deno task types:deno && deno task types:node", - "doc:deno": "mkdir -p gen/deno && DENO_INTERNAL_HTML_DOCS=deno deno doc --html --name=Deno --category-docs=deno-categories.json --output=gen/deno --strip-trailing-html types/deno.d.ts", "doc:web": "mkdir -p gen/web && DENO_INTERNAL_HTML_DOCS=deno deno doc --html --name=Web --category-docs=web-categories.json --output=gen/web --strip-trailing-html types/web.d.ts", "doc:node": "mkdir -p gen/node && DENO_INTERNAL_HTML_DOCS=node deno doc --html --name=Node --output=gen/node --symbol-redirect-map=node-symbol-map.json --default-symbol-map=node-default-map.json --strip-trailing-html types/node/[!_]*",