Uh oh!
There was an error while loading. Please reload this page.
feat: add react docgen - #111
Conversation
There was a problem hiding this comment.
Looks really good 👍
This will probably have to be part of a separate PR since it'll mean changing how we render and style our docs significantly, but it'd be nice if we could set a minimum column width for the generated tables.
For example, here we can see the type column is too wide and description too thin:
Unfortunately markdown does allow specifying column widths, so we'd need to switch to using HTML for rendering these tables. Plus, being able to render shape props multi-line (so {key1: type1\n, key2: type2\n} would also help.
KaiVandivier
commented
Jul 29, 2021
Yeah it would be nice to have some formatting control over the tables! I thought newlines weren't possibly inside of the markdown tables, but I just learned that |
Mohammer5
commented
Jul 29, 2021
KaiVandivier
commented
Jul 29, 2021
So due to the limitations of markdown tables, I don't think supporting newlines is going to work without being able to control the size of columns: I agree it would be nice to only document exported components, but I also agree that's tricky to do in a generalizable way. If you can think of a smart way to do it I'm open to it! I think this iteration is "good enough" though since it's searchable, and there might be some utility for developers to getting the internals' APIs too. Hopefully some other context cues will point to what's exported as well, like component and prop type descriptions. Also, just a reminder that for the UI library, this will be supplement to the storybook, and the storybook should probably get more attention ultimately Related to that, @Mohammer5 maybe that |
Maybe the script takes a path/glob to one or more files that export components ( |
Mohammer5
commented
Jul 29, 2021
Agreed, you can merge it when you think this PR is ready
The command could expect a path / paths to javascript files and only generate the docs for the functions/components exported from these files (e. g. |
Mohammer5
commented
Jul 29, 2021
Ah, that's quite neat! Will add |
KaiVandivier
commented
Jul 30, 2021
@mediremi@Mohammer5 I switched the format to HTML tables which is a nice improvement, and parsing prop descriptions as multiline markdown is now supported: 🎉
|
mediremi
commented
Jul 31, 2021
Nice that's already a big improvement 💪 On my screen + font combo things are still a bit squished so I've tried making some changes here: https://github.com/dhis2/cli-utils-docsite/compare/feat-add-react-docgen...feat-add-react-docgen-proposals?expand=1 The main difference is that the 'required' column has been removed and instead an asterisk is shown next to the property name, and custom prop types are rendered using their name if longer than 20 characters. |
Mohammer5
commented
Aug 3, 2021
🎉 That looks a lot better! |
feat: add react docgen proposals
feat: implement DHIS2 docsify theme
feat: add react docgen source links
feat: handle imported/exported components
Uh oh!
There was an error while loading. Please reload this page.
# [3.1.0](v3.0.0...v3.1.0) (2021-08-09) ### Features * add react docgen ([#111](#111)) ([99fdc48](99fdc48))
dhis2-bot
commented
Aug 9, 2021
🎉 This PR is included in version 3.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |






Uses React Docgen to parse React components & comments to generate API documentation, which is part of consolidating documentation in the UI library: https://jira.dhis2.org/browse/LIBS-149
There are somethings in the branch currently to help test it out:
buildandservescripts that parse docs from the UI library - if youruiandcli-utils-docsitedirectories are not siblings, you'll need to change the pathservecommandTo do before merging: