-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs-infra] Prepare infra to document charts interfaces #12653
Conversation
Deploy preview: https://deploy-preview-12653--material-ui-x.netlify.app/ |
44f1cc5
to
f5aeb59
Compare
docs/scripts/api/buildApi.ts
Outdated
@@ -78,29 +87,111 @@ export default async function linkifyTranslation( | |||
); | |||
} | |||
|
|||
const specialAPIs: { folder: string; packages: XProjectNames[]; documentedInterfaces: string[] }[] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to define those in a new file next to getComponentInfo
in buildApiDocs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- make sens: yes
- feasible: no
😅
The API build is done in two times in X docs:
yarn docs:api:build && yarn docs:api:buildX
- The generation of components API done by the pipeline we import from core and defined by those files in
buildApiDocs
- The one specific to X that generate files for the events, selectors, interfaces and API
I tried once to merge those two scripts. But it's... complicated.
The core script is written without taking care about project relations, because each component can be done independently.
The X script is more project related, because knowing in which project properties are defined implies their pricing level (community, pro, premium) Plus when generating pages to document interfaces, we update an object to know all the pages generated, and then override the translation such that [[GridAPI]]
is transformed in a link to the API page of the grid api.
In brief, core does
for project in projects:
for component in project:
generateApiPage(component)
And X does
generatedPages = {}
for interface in interfacesToDocument:
generateApiPage(interface, projects, generatedPages)
for project in dataGridProjects:
for apiInterface in project:
generateApiPage(apiInterface)
for translation in treanslationFiles:
updateLinks(translation, generatedPages)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then maybe moving it to createXTypeScriptProjects
Basically my issue is to have a new project-related config inside a file that people might struggle to find.
The more we centralize, the better I am 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more we centralize, the better I am 😆
That's a political opinion? 😇😆
Then maybe moving it to
createXTypeScriptProjects
The file name is not well adapt, but it will make those parameters more visible 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
1.Isolate the interfaces docs pages from the API JSON generation
2. Allow to get interfaces from some specific packages
3. Remove most of the hard coded values specific to the data grid
This PR is used to add interfaces for x-charts in #12656
Could be used the same way to add interfaces pages for tree view