Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion scripts/verify-links.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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/')

Expand Down