Skip to content

fix: normalize globby paths in deadLinkChecker for Windows compatibility#8481

Open
Umesh-369 wants to merge 1 commit into
reactjs:mainfrom
Umesh-369:fix-windows-deadlinks
Open

fix: normalize globby paths in deadLinkChecker for Windows compatibility#8481
Umesh-369 wants to merge 1 commit into
reactjs:mainfrom
Umesh-369:fix-windows-deadlinks

Conversation

@Umesh-369

Copy link
Copy Markdown

Description

This PR fixes a cross-platform compatibility bug in the scripts/deadLinkChecker.js script.

On Windows machines, running yarn deadlinks results in hundreds of false-positive anchor errors (e.g., 556 dead links out of 1822 total links). This happens because globby.sync returns POSIX-style paths (using forward slashes /), while Node's native path.join (used during validation/lookup) returns Windows-style paths (using backslashes \). As a result, the lookup keys in anchorMap do not match, causing all anchor check lookups to fail.

Solution

In scripts/deadLinkChecker.js, inside the getMarkdownFiles() function, we map path.normalize(p) onto the array returned by globby.sync():

return globby.sync(patterns).map((p) => path.normalize(p));

@github-actions

Copy link
Copy Markdown

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant