[docs-infra] Update Index to Filter Private Entries#4239
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
mnajdova
left a comment
There was a problem hiding this comment.
Let's revert the unnecessary changes to the mdx files, only keep the relevant changes and change one mdx to private just so we can test things out.
| ], | ||
| }; | ||
| export const metadata = | ||
| /** @type {import('@mui/internal-docs-infra/pipeline/transformMarkdownMetadata/types').Metadata} */ ({ |
There was a problem hiding this comment.
Can we add the typeonly on pages that actually use params not defined in the next.js type?
There was a problem hiding this comment.
Right now the metadata doesn't have any JSDocs so even the Next.js types aren't shown when hovering or autocomplete. If we have the type here, then our added metadata options are discoverable. This type extends Next.js' types too.
If we don't put our metadata type here, I think we should at least put the @type for Next.js metadata.
Edit: I reverted this for now
There was a problem hiding this comment.
We can do it in a follow-up, just so we don't clatter this PR.
|
I'll separate out the unrelated changes into another PR to keep this one minimal |
|
@mnajdova Ok, the unrelated changes are reverted, I renamed to |
…thub.com:dav-is/base-ui into docs-infra/update-index-to-allow-private-entries
|
It looks good to me 👌 Do you plan to add more things in this PR? I am asking because it's still in draft |
No, I can do it in a followup PR. It's a draft because we need to merge mui/mui-public#1109 before this PR can be merged. That PR should be ready to go whenever it is approved |
| /** @type {import('@mui/internal-docs-infra/createSitemap/types').NextMetadata} */ ({ | ||
| keywords: [], | ||
| robots: { | ||
| index: false, |
There was a problem hiding this comment.
Will this work for the generateMetadata function ?
There was a problem hiding this comment.
generateMetadata is not supported by page indexes today because it requires running the build and rendering the page. When we use export const metadata, we can statically analyze by parsing the file. I want to support it eventually, but we need to further optimize Base UI's build pipeline so that a cached build takes less than 5 seconds (my target).
mnajdova
left a comment
There was a problem hiding this comment.
I left two more comments, I don't see anything blocking. Let's update the infra package and merge this one 👌
| @@ -0,0 +1,18 @@ | |||
| # Calendar | |||
There was a problem hiding this comment.
We can drop this page as there are other pages where we can test the private flag.
| import 'docs/src/css/index.css'; | ||
| import './layout.css'; | ||
|
|
||
| const showPrivatePages = process.env.SHOW_PRIVATE_PAGES === 'true'; |
There was a problem hiding this comment.
We should make sure we don't forget to set this flag before the next deployment.
There was a problem hiding this comment.
This is set within docs-infra code withDeploymentConfig
Update pages index to use new format from mui/mui-public#1109 released in
0.5.1-canary.0Adds private Calendar page: https://deploy-preview-4239--base-ui.netlify.app/react/components/calendar (this page will not appear at https://master--base-ui.netlify.app/). Based on this ENV variable: https://github.com/mui/mui-public/blob/df142b55588e09b911db8be848c133b0ebad1cc0/packages/docs-infra/src/withDocsInfra/withDeploymentConfig.ts#L8-L46
Also adds filtering from navigation and search when pages are marked with
audience: private:metadata.robots.index: falseis how Next.js adds theno-indexmeta: https://nextjs.org/docs/app/api-reference/functions/generate-metadata#robots