Skip to content

feat: add sidebar validation and update API docs structure - #1229

Merged
dsanders11 merged 1 commit into
mainfrom
claude/happy-mccarthy-70wvxn
Sep 23, 2026
Merged

dsanders11 merged 1 commit into
mainfrom
claude/happy-mccarthy-70wvxn

Conversation

@erickzhao

Copy link
Copy Markdown
Member

Description of Change

This PR adds automated validation for the sidebar configuration and makes several updates to the API documentation structure:

New Features:

  • Added scripts/check-sidebars.ts - a validation script that ensures:
    • Every API doc under docs/latest/api has a corresponding sidebar entry (directly or via autogenerated directives)
    • Every doc ID referenced in sidebars.js points to an existing file on disk
    • This prevents new API pages from silently shipping without sidebar entries
  • Integrated the validation into the lint pipeline via npm run lint:sidebars

Sidebar Updates:

  • Renamed "Custom DOM Elements" category to "Custom Web Features"
  • Added new API docs to the Classes section: clipboard-item, ipc-main-service-worker, web-socket
  • Added corner-smoothing-css to the Custom Web Features category
  • Converted the "API Structures" category from a manually-maintained list to use autogenerated directive for latest/api/structures/ directory

Configuration Improvements:

  • Updated docusaurus.config.ts to customize the sidebar item generator for autogenerated items, ensuring they sort by doc ID rather than file path (so certificate.md appears before certificate-principal.md)
  • Updated i18n translations to reflect the category name change

Checklist

  • I have reviewed and verified the changes

https://claude.ai/code/session_01XMfdywBDQap5GoK4NkEFTE

The API sidebar in sidebars.js is maintained by hand while the docs
under docs/latest are synced from electron/electron, so new API pages
were regularly landing with no sidebar entry (25 at the time of this
change).

- Generate the "API Structures" category from docs/latest/api/structures
  with an `autogenerated` sidebar item, sorted by doc id via a
  `sidebarItemsGenerator` so `certificate` still precedes
  `certificate-principal`.
- Add `scripts/check-sidebars.ts` (run as `lint:sidebars` from `lint`)
  which fails when an API doc has no sidebar entry or a sidebar entry
  points to a missing doc.
- Add the unlisted ClipboardItem, IpcMainServiceWorker and WebSocket
  classes and the `-electron-corner-smoothing` CSS rule, renaming
  "Custom DOM Elements" to "Custom Web Features" to match upstream.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XMfdywBDQap5GoK4NkEFTE
@erickzhao
erickzhao requested a review from a team as a code owner September 23, 2026 23:19
@erickzhao erickzhao changed the title Add sidebar validation and update API docs structure feat: add sidebar validation and update API docs structure Sep 23, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this PR and didn't find any bugs. Because docusaurus.config.ts, package.json, and sidebars.js fall outside docs/ and are covered by the @ electron/wg-ecosystem CODEOWNERS entry, a human review from that team is still worthwhile.

What was reviewed:

  • Cross-checked all 76 top-level API docs against the sidebars.js api section: full coverage, no missing or orphaned entries.
  • Confirmed the new autogenerated item for latest/api/structures covers all 102 structure docs on disk, several of which were absent from the old hand-maintained list.
  • Verified the "Custom DOM Elements" -> "Custom Web Features" rename is applied consistently in sidebars.js and the i18n label in current.json.
  • Checked the check-sidebars.ts doc-id collection/validation logic and the new sidebarItemsGenerator sort key in docusaurus.config.ts for correctness.
Extended reasoning...

The change adds scripts/check-sidebars.ts (a new lint step wired into npm run lint) plus edits to docusaurus.config.ts, package.json, sidebars.js and one i18n label file, touching no auth/crypto/permission code and no injection or data-exposure surface. I manually cross-referenced every file under docs/latest/api and docs/latest/api/structures against the new sidebars.js and confirmed full, exact coverage with no gaps or leftovers, and confirmed the category rename was applied everywhere. The repo's CODEOWNERS wildcard (* @ electron/wg-ecosystem, with only /docs/ carved out) covers all five changed files here, which is the deciding factor for deferring rather than approving outright, since this is not a change docusaurus/website-only automation is meant to bypass human sign-off on.

Comment thread sidebars.js
'latest/api/structures/shared-dictionary-info',
'latest/api/structures/shared-dictionary-usage-info',
],
items: [{ type: 'autogenerated', dirName: 'latest/api/structures' }],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome.

@dsanders11
dsanders11 merged commit c91c716 into main Sep 23, 2026
9 of 10 checks passed
@dsanders11
dsanders11 deleted the claude/happy-mccarthy-70wvxn branch September 23, 2026 23:35
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.

3 participants