chore(i18n, scripts): generate CLI and native pages as .mdx - #4693
Open
thetaPC wants to merge 1 commit into
Open
chore(i18n, scripts): generate CLI and native pages as .mdx#4693thetaPC wants to merge 1 commit into
thetaPC wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue URL: internal
What is the current behavior?
Every doc page on this branch is now named
.mdxexcept two directories: the CLI command pages and the Capacitor plugin pages, which are written byscripts/cli.mjsandscripts/native.mjson every build and still land as.md.These are pages, not fragments. They get routes, sidebar entries, and URLs like any other page, so the rule worth having is simply that doc pages are
.mdx. Right now it is that doc pages are.mdxexcept two directories, and the exception is invisible: the output is gitignored, so it only shows up on a local disk after a build.There is also a practical risk. If anyone adds an import or a component to those generator templates, the output breaks once Strict MDX is enabled, and the failure shows up as a blank section rather than an error.
What is the new behavior?
The two generators emit
.mdx, and the 54 links pointing into those trees are updated to match.That is the whole change: two lines in the generators, and 32 pages containing links to the pages they produce. Nothing is renamed in git, because the output is untracked. The old
.mdfiles disappear the next time the generators run.Does this introduce a breaking change?
Other information
Please merge this before the matching PR on main, not after.
The two are coupled, and the coupling is easy to miss. These generated pages are gitignored, so they are not in the tarball that
scripts/i18n.shbuilds from this branch. That means the Japanese production build resolves this branch's links to them against main's copies rather than any copy here. When main renames those files, these links break.That was measured rather than assumed: building the Japanese locale with main's version of this change and this branch left unchanged produces 11 newly broken link targets, all resolving into
native/andcli/commands/. The build still exits 0, becauseonBrokenLinksis set towarn, so it would ship green with dead links.Merging this branch first avoids that. A merge here does not trigger a production deploy, only a preview of this branch, so the Japanese site keeps serving its last good build until main next changes. By then both sides match. Merging main first breaks it immediately and with certainty.
Note that the
extensionAliasentry does not help here. That covers imports, which webpack resolves, not markdown links, which Docusaurus resolves separately.Verification, compared against a build taken before the change:
The build completes with 0 errors and the same 2326 pages. Broken links stay at 24 and broken anchors at 103, with none introduced. Prettier reports no differences and the spell checker reports none across 21,571 files. All 83 generated pages build and are reachable. There are now zero
.mdlinks and zero.mdimports anywhere indocsorversioned_docs/version-v8.How to test
Nothing should look different. These pages are generated from the same source data as before, so a failure shows up as a missing page or a dead link rather than as changed content.
Check that a CLI command page and a Capacitor plugin page still render, and that both appear in the sidebar in their usual positions.
Then follow a link into one of those trees from a hand-written page. The framework getting-started guides link to the Camera, Filesystem, and Preferences plugin pages, and the CLI configuration and livereload pages link to individual command pages. Those inbound links are the part this PR changes.