Skip to content
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

Merged
merged 3 commits into from Apr 17, 2024

Conversation

alexfauquette
Copy link
Member

@alexfauquette alexfauquette commented Apr 3, 2024

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

@mui-bot
Copy link

mui-bot commented Apr 3, 2024

Deploy preview: https://deploy-preview-12653--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 685c41c

@alexfauquette alexfauquette added component: data grid This is the name of the generic UI component, not the React module! scope: docs-infra Specific to the docs-infra product labels Apr 3, 2024
@@ -78,29 +87,111 @@ export default async function linkifyTranslation(
);
}

const specialAPIs: { folder: string; packages: XProjectNames[]; documentedInterfaces: string[] }[] =
Copy link
Member

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?

Copy link
Member Author

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
  1. The generation of components API done by the pipeline we import from core and defined by those files in buildApiDocs
  2. 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)

Copy link
Member

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 😆

Copy link
Member Author

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 👍

Copy link
Member

@cherniavskii cherniavskii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@alexfauquette alexfauquette merged commit 5899fbb into mui:master Apr 17, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! scope: docs-infra Specific to the docs-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants