chore(scripts): generate CLI and native pages as .mdx - #4692
Open
thetaPC wants to merge 1 commit into
Open
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 in the repository 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 appears 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
This deliberately lands before the removal of the transitional MDX compatibility code, so it can be verified on its own.
That ordering matters for an unobvious reason. The
resolve.extensionAliasentry currently maps a.mdimport onto a.mdxfile, so while it is in place a missed link would resolve anyway and the build would stay green. A passing build here is therefore weaker evidence than it looks.What actually verifies this change is a static check rather than the build: every link was resolved against a real file on disk, and there are now zero
.mdlinks and zero.mdimports left anywhere indocsorversioned_docs/version-v8. That check does not depend on the alias. Removing the alias in the follow-up is what proves it properly, since anything missed will then fail loudly.Verification, compared against a build taken before the change:
The build completes with 0 errors. Broken links stay at 21 and broken anchors at 47, with none introduced. Prettier reports no differences, and the spell checker reports none across 10,918 files. All 73 generated pages build and are reachable.
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, for example the
ionic buildcommand page and the Camera plugin page, 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.