Skip to content

fix(docs): normalize sidebar path separators for Windows - #2405

Draft
sidsri14 wants to merge 1 commit into
temporalio:mainfrom
sidsri14:fix-docs-sidebar-windows-separators
Draft

fix(docs): normalize sidebar path separators for Windows#2405
sidsri14 wants to merge 1 commit into
temporalio:mainfrom
sidsri14:fix-docs-sidebar-windows-separators

Conversation

@sidsri14

@sidsri14 sidsri14 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #2402: building the docs sidebar on Windows fails with Cannot read properties of undefined (reading 'toLowerCase') because path.relative returns backslash-separated paths on Windows, so url.split('/')[1] (the category) is undefined.

What changed

  • packages/docs/sidebars.js: normalize the doc-relative path to forward slashes (\\/) before category extraction and doc-ID construction, via a small relativeDocUrl helper. The generated doc IDs remain forward-slash paths on all platforms.
  • Added packages/docs/sidebars.test.js (Node's built-in node:test runner, no new dependencies) and a test script for @temporalio/docs. The tests cover forward-slash, Windows-style, and multi-dot basename inputs. CI's pnpm run test runs on windows-x64 too, so this is a real regression test for the affected platform.

Verification

  • node --test packages/docs/sidebars.test.js → 3/3 pass.
  • prettier --check clean on all changed files.
  • Full docusaurus build requires a dependency install and POSIX shell for the build-docs env assignments, so it wasn't run locally; the bug reproduces purely in sidebar generation, which the unit tests exercise.

AI disclosure

Code authored with the assistance of an AI coding agent.

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.

[Bug] API sidebar generation fails on Windows path separators

1 participant