-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Addon-docs: Load prop table from file #7942
Comments
Love this. It will also help for frameworks like Angular #6664 where there might not be a loader handy. I'd like some time to think about how to integrate this most cleanly cc @South-Paw https://github.com/South-Paw/storybook-addon-overview-angular |
great, pls let me know when you are ready with how it should work (especially how to configure the file names to load the prop tables from - in my case they are in the same folder as the story, has a name like the component displayName, and an extension .json - but I suppose people can have them in different places.) |
I'll +1 this. A prop table cache would be pretty sick. I'd gladly help (as available) and/or test (as ready) this kind of feature. |
@clintandrewhall - any chance you can try my temporary solution in the meantime? Would love to get your feedback on the configuration options we can have. |
@atanasster Relevant: #8585 #8489 |
This is a great idea! I need to customize the props table because I need to filter out some props from the documentation (for some interesting reason specific to my project). A props file would work perfectly in my case. |
@laplacesdemon you can also filter with |
Just released https://github.com/atanasster/webpack-react-docgen-typescript for caching and speed up of parsing typescript prop tables. Feedback and issues welcome to get it stable. |
Parsing prop tables for typescript project takes a long time. react-docgen-typescript-loader parses all the prop table on every storybook load.
However most times the prop tables very rarely change. A faster solution would be to generate prop table files only once in a while when the props of the components actually change.
If possible can you allow for loading prop tables from external files. By default, I am naming the external .json files for an example story ComponentName.stories.tsx as ComponentName.json
example external json file generated using directly "react-docgen-typescript":
https://github.com/atanasster/grommet-controls/blob/master/src/components/ColorInput/doc/ColorInput.json
my current (temporary) solution to use a webpack plugin to load the prop tables from files:
https://github.com/atanasster/grommet-controls/blob/master/.storybook/webpack.config.js
my current script to generate external json prop tables:
https://github.com/atanasster/grommet-controls/blob/master/tools/generate-docs.js
If the feature request is accepted I can clean up my script and release it for other people to also use if they have typescript docgen prop tables.
The text was updated successfully, but these errors were encountered: