-
Notifications
You must be signed in to change notification settings - Fork 843
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
feat: add JSON docgen generator to feed docusaurus website with accurate prop definitions #7927
Conversation
@@ -0,0 +1,73 @@ | |||
import { EuiBasicTable, EuiMarkdownFormat, EuiBasicTableColumn, EuiTextColor, EuiCode } from '@elastic/eui'; |
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.
This component is just for demonstration purposes only and will be heavily refactored in a separate PR.
"dist", | ||
"lib" | ||
], | ||
"types": "./lib/index.d.ts", |
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 only exports are the type definitions for the interfaces this package defines
@@ -0,0 +1,96 @@ | |||
import type { PropItem } from 'react-docgen-typescript'; |
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.
Most of this source code comes from https://github.com/elastic/eui/blob/main/packages/eui/scripts/babel/react-docgen-typescript.js and is purposefully left as is to keep the prop table data the same as on the current documentation site.
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.
🗒️ Considering that it's mainly copied, I won't do an in depth review of it.
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.
I checked the output locally on a couple of components and it looks really good! 🎉
I left a couple of comments, most are related to the props table output which can be addressed separately.
@@ -0,0 +1,96 @@ | |||
import type { PropItem } from 'react-docgen-typescript'; |
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.
🗒️ Considering that it's mainly copied, I won't do an in depth review of it.
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! Thanks for the updates!
💚 Build Succeeded
History
cc @tkajtoch |
Summary
Resolves #7926
This PR adds a new private package
@elastic/eui-docgen
that generates docgen JSON files for all EUI source files just like the babel script did. It reuses most of the old code and results in lots of definition JSON files being generated. This PR also adds an example page to docusaurus and very, very basicPropTable
component to thedocusaurus-theme
package. These will be updated and improved in following PRs.QA
yarn
packages/website
and build all of its local dependencies:yarn workspaces foreach -Rpt --from @elastic/eui-website run build
yarn start