Skip to content

Commit 3c2c3e6

Browse files
fix(docs): normalize path separators in the content build on Windows (#10067)
path.relative returns backslash-separated paths on Windows, so navigation keys and page URLs never matched the forward-slash entries in meta.json and content:generate failed. Normalize the relative path to forward slashes once; no-op on macOS and Linux. Fixes #10066
1 parent 0f51f99 commit 3c2c3e6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎apps/docs/scripts/compile-content.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ async function generate() {
211211
const dates = lastModified()
212212
let compiled = 0
213213
for (const file of await filesIn(CONTENT_ROOT)) {
214-
const relative = path.relative(CONTENT_ROOT, file)
214+
// Navigation keys and page URLs below assume `/`; on Windows path.relative returns `\`.
215+
const relative = path.relative(CONTENT_ROOT, file).split(path.sep).join('/')
215216
if (relative.endsWith('meta.json')) {
216217
const parsed = metadataSchema.safeParse(JSON.parse(await readFile(file, 'utf8')))
217218
if (!parsed.success) throw new Error(`${relative}: ${parsed.error.message}`)

0 commit comments

Comments
 (0)