-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[Add] Docgen auto generation of docs scripts #3136
[Add] Docgen auto generation of docs scripts #3136
Conversation
Codecov Report
@@ Coverage Diff @@
## next #3136 +/- ##
=======================================
Coverage 83.85% 83.85%
=======================================
Files 78 78
Lines 1685 1685
Branches 664 664
=======================================
Hits 1413 1413
Misses 268 268
Partials 4 4
Continue to review full report at Codecov.
|
@@ -20,4 +20,4 @@ const styles = StyleSheet.create({ | |||
}, | |||
}); | |||
|
|||
CardDivider.displayName = 'CardDivider'; | |||
CardDivider.displayName = 'Card.Divider'; |
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.
Why not CardDivider
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 name should be the same as the use-case, therefore I have changed it. As users are going to use it as Card.Divider. Also, this will help detect the parent directory by splitting using the '.'. The first part would be the Base component dir and the 2nd part will be the children.
What kind of change does this PR introduce?
This PR introduces adding scripts to generate docs automatically. It uses
react-docgen-typescript
to achieve the same.Did you add tests for your changes?
No.
React docgen Typescript
, for now, has its own tests and we can rely on them as they are stable. We can add tests to our code in the future. I plan to add them if needed in the future with a single PR.If relevant, did you update the documentation?
Will be done later with a single PR.
Summary
To run the scripts for now and generate the documentation run the command:
This will trigger
scripts/docgen/index.tsx
script. It calls the functiongetAndStoreComponentDocs
which callsgetComponentFiles
which is a utility to get all the file paths of the components in the form of an array. This is served as input to thegenerateComponentDocs
which generate the component docs usingreact-docgen-typescript
. The result is stored inside the.docgen
directory in the respective folders.The scripts have the respective files:
componentMap.ts
to a single array of files having all the component file paths.Does this PR introduce a breaking change?
No.
Other information
Disclaimer: These are the initial scripts to generate JSON just to make sure that the data is received for every prop type and descriptions are fetched. There will be changes in future PRs once the Markdown is generated.
Tags
#gsoc #docs-autogen #khushal87