Upgrade to Docusaurus 3#3144
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedToo many files! This PR contains 300 files, which is 150 over the limit of 150. To get a review, narrow the scope: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (300)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| > `docs-sourcer`'s `src/services/content-service.ts` to `{/* ##DOCS-SOURCER-START` | ||
| > and `##DOCS-SOURCER-END */}`, release a new version, then this repo's existing | ||
| > file format works directly. After that, the `<!-- -->` wrappers can be removed | ||
| > from these files. |
There was a problem hiding this comment.
The docs-sourcer has two usage mechanisms:
- on demand: to run plugins when desired
- webhook-integration: the docs-sourcer is deployed as an app and responds to GitHub events to open PRs automatically for preview usecases and module releases in the IAC library repos
The integration means we can't rely on
do not run
yarn run-docs-sourcer(oryarn regenerate)
since we would likely break docs on the next automated release.
The docs-sourcer needs to be updated first to align with the v3 required changes and then used to regenerate all its content so we can merge that in as prep for the v3 migration. That would
- Make this PR significantly easier to review.
- Ensure the metadata signature is updated by the tool that generated the automated content.
- Prevent breaking the webhook-integration
The next steps as I see them are:
- Itemizing all the changes that need to happen in the docs-sourcer. I already noted the metadata comment wrapping, link updates, Github discussion body updates(they contain html comments)
- Dropping all changes to files that have the docs-sourcer metadata from this PR
- Implementing the changes in docs-sourcer
- Doing a re-run with the new docs-sourcer to correctly update content it manages
- Coordinating the merge of those changes with the actual v3 change.
Summary
Brings the docs site green on Docusaurus 3 with future.v4: true and trailingSlash: true. Five categories of mechanical changes plus targeted swizzle rewrites for the CodeBlock theme refactor.
What changed
1. MDX 3 syntax compliance (~595 doc files)
2. CodeBlock theme swizzle migration (src/theme/CodeBlock/)
Docusaurus 3 rewrote the CodeBlock components around a new context provider + slot-based architecture. The site's three customizations (CustomizableValue integration in titles, copy handler, and line tokens) were ported.
3. Redirect collisions (2 deletions)
Removed docs/library/stay-up-to-date/{updating,versioning}.md. These pages had been superseded by /2.0/docs/library/guides/updating-modules and /versioning, with redirects already in src/redirects.js. The new client-redirects plugin refuses to overwrite real pages (older versions silently ignored this).
4. Internal link rewrites (~131 doc files)
Replaced 148 internal references to the deleted pages with their /2.0/docs/library/guides/... equivalents. Docusaurus 3's broken-link checker no longer trusts redirect targets, so links must point to canonical URLs.
5. Trailing-slash relative-path fixes (14 files)
The trailingSlash: true change broke a small number of pre-existing relative links (now resolving one directory deeper than intended). Converted to absolute paths or corrected ../ depth in:
6. Segment plugin runtime guard
Added src/clientModules/segmentShim.js, registered in docusaurus.config.js. The unmaintained @twilio-labs/docusaurus-plugin-segment@0.1.0 (peer-deps React 16/17) loads its onRouteDidUpdate callback in Docusaurus 3 dev mode despite skipping the inline init snippet, leaving window.analytics undefined and crashing on navigation. The shim defines window.analytics as a no-op fallback, which also hardens production against ad-blockers/CSP that block the Segment loader.
Test plan
Out of scope