Skip to content
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

DocsPage not populated from JSDoc comments #103

Closed
IanVS opened this issue Sep 28, 2021 · 1 comment · Fixed by #299
Closed

DocsPage not populated from JSDoc comments #103

IanVS opened this issue Sep 28, 2021 · 1 comment · Fixed by #299

Comments

@IanVS
Copy link
Member

IanVS commented Sep 28, 2021

I believe this is a known issue, but I didn't see an issue opened for it specificially.

Normally, any JSDoc written for the component or the props will appear in the docs page, but this does not occur with the vite builder. I believe this is due to react-docgen running in the default webpack builder. There are efforts underway to decouple them, as mentioned in #46 (comment).

IanVS pushed a commit that referenced this issue Feb 3, 2022
Related to #103 #2 #79

This PR adds doc-gen via react-docgen-typescript.

| | Before | After|
| --- | --- | --- |
| Sidebar | ![localhost_52700__path=_story_example-introduction--page](https://user-images.githubusercontent.com/12938082/152376764-b5fa8048-8e7a-47fa-b15f-c10d1b0a3feb.png) | ![localhost_55358__path=_story_example-introduction--page](https://user-images.githubusercontent.com/12938082/152375596-eed09e52-03bf-4e6d-9ce0-b8ef28bfdbee.png)
| Docs | ![image](https://user-images.githubusercontent.com/12938082/152377428-ffaa0b12-d453-4540-a0d3-b66d27371a1b.png) | ![image](https://user-images.githubusercontent.com/12938082/152378055-7d65504e-621f-48d6-a0d4-879171086832.png)

I haven't noticed any significant impact to speed. 🎉 

 It's hooked up to the storybook config so it should act as a drop-in for the webpack functionality for typescript types.
@IanVS
Copy link
Member Author

IanVS commented Feb 3, 2022

Note that https://github.com/eirslett/storybook-builder-vite/releases/tag/v0.1.15 includes a fix that will make this work correctly for typescript projects. Keeping this open until we support non-typescript as well, though.

@IanVS IanVS closed this as completed in #299 Apr 3, 2022
IanVS added a commit that referenced this issue Apr 3, 2022
Fixes #103
Closes #190
Fixes #2

This takes a slightly different approach from #190.  Instead of using a babel transform, this creates a vite plugin, similar to the vue-docgen plugin, but based on the babel-plugin-react-docgen.  This gives us the chance to rely directly on react-docgen, without needing another package in between, and it avoids being accidentally overwritten if users replace our @vitejs/plugin-react with their own config.

This new vite plugin is not configurable like the babel plugin is, but I'm not certain those configurations are necessary in the first place.  If we hear from users that it's something they need, we can find a way to make them customizable, but I prefer to avoid extra options if possible.

This version does not create a global list of all the docs, like the babel plugin does (`DOC_GEN_COLLECTION_NAME`).  I looked through the storybook source, and it doesn't seem like anything still relies on it, so I think it's just a legacy detail for now that we can probably avoid supporting.

I've updated the react example to demonstrate the use of the plugin, so feel free to check this out there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant