From 9fc856b8df90c2db75bdbeaa2e04ed91460bed7b Mon Sep 17 00:00:00 2001 From: Yogesh Kumar Date: Thu, 13 Aug 2026 11:13:18 +0530 Subject: [PATCH] fix(scripts): make the docs link check work on Windows 'relativeLinkExists' builds the target path with 'path.resolve', which uses the platform separator, but then matches it against '/examples/' and rewrites it with a regex written in forward slashes. On Windows the resolved path uses backslashes, so neither pattern matches. Every documentation link that points at an example is looked up as a markdown file under 'docs/framework//examples/' instead of a directory under 'examples//', and 'pnpm test:docs' reports 27 broken links that are fine on CI. Normalize the separators before the two comparisons. Node accepts forward slashes on Windows, so the resolved path stays usable. --- scripts/verify-links.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/verify-links.ts b/scripts/verify-links.ts index 8a1c40ddc51..7e8af4e7600 100644 --- a/scripts/verify-links.ts +++ b/scripts/verify-links.ts @@ -1,5 +1,5 @@ import { existsSync, readFileSync, statSync } from 'node:fs' -import { extname, resolve } from 'node:path' +import { extname, resolve, sep } from 'node:path' import { glob } from 'tinyglobby' // @ts-ignore Could not find a declaration file for module 'markdown-link-extractor'. import markdownLinkExtractor from 'markdown-link-extractor' @@ -53,6 +53,11 @@ function relativeLinkExists(link: string, file: string): boolean { return false } + // `resolve` uses the platform separator, but the patterns below are written + // with forward slashes, so match against a normalized copy of the path. + // Node accepts forward slashes on Windows too, so the result stays usable. + absPath = absPath.split(sep).join('/') + // Check if this is an example path const isExample = absPath.includes('/examples/')