rnx-kit
rnx-kit copied to clipboard
Generate website API docs from code comments
Use a tool to extract APIs and types from @rnx-kit packages. Embed them into the API docs on the website.
Example packages which can help with this:
- https://github.com/atomicpages/docusaurus-plugin-react-docgen-typescript
- https://api-extractor.com/
yes pls! 👏
For context, there were some attempts also on the rn repo a long time ago: https://github.com/facebook/react-native/commit/eb7dbc8532ce12d912c750c395ed555f444f436e but as far as I know it's not actually used. I can reach out to a couple folks to verify the state of that script logic
UPDATE: it looks like the logic above was never used, but there was also this other attempt: https://github.com/facebook/react-native-website/tree/main/sync-api-docs but this one too has never been used
on the Expo side of things, they use a solution based on https://typedoc.org/ to export JSON
You can find the logic here: https://github.com/expo/expo/blob/main/docs/components/plugins/APISection.tsx + https://github.com/expo/expo/tree/main/docs/components/plugins/api
Just an FYI, we are currently using TSDoc to generate the API tables for the tools-*
's README
files:
https://github.com/microsoft/rnx-kit/blob/99854bb31038b6069047ef8ac2777ba4dacd1dd3/scripts/src/commands/updateApiReadme.js#L8
It has its own quirks. For instance, you have to manually concatenate the lines, parse parameters AST-style, and other things. It's doable, but not very friendly/maintainable. Would be interested to learn whether TypeDoc is better in this regard.