storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
83.6k stars 9.16k forks source link

[Bug]: Descriptions from JSDocs not rendered for Angular stories in 7.0.0-beta.60 #21387

Closed freon27 closed 7 months ago

freon27 commented 1 year ago

Describe the bug

I have a Storybook set up for an Angular library which is using autodocs. I have updated to CSF3.

If I put JSDocs above my exported functions, they do not appear in the Doc page, either for the main description or on the individual stories.

e.g. following the docs, I had the following, but the description is not rendered.

/**
 * It should be possible to write a description here
 */
export const ExtensionCaseSensitive = {
  render: (args: FileDropzoneComponent) => ({
    props: args,
  }),
...

To Reproduce

https://github.com/freon27/storybook-issue-repro/

The doc page for Header should show the JSDocs (as far as I understand it).

System

No response

Additional context

No response

shilman commented 1 year ago

Good golly!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-rc.4 containing PR #21629 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb@next upgrade --prerelease
JReinhold commented 1 year ago

The original fix was reverted by https://github.com/storybookjs/storybook/pull/22048, because testing proved that it wasn't necessary anymore. However that is not the case apparently, as this issue is back.

shilman commented 1 year ago

@valentinpalkovic @vanessayuenn FYI I have verified that the reproduction still exists in the latest version of Storybook (7.0.20 as of this comment). I had to delete the package-lock.json in the repro since it references some private npm server or something. I suspect that this is only an Angular problem since I've used the comment => description behavior in React for something else today and it's working fine (at least in Vite, did not test Webpack).

mjaysona commented 1 year ago

Can confirm this issue still exists using Angular 14.3 and Storybook 7.0.21.

richard-ncs commented 1 year ago

I can confirm that this is still an issue on Storybook 7.1.0 and Angular 16. It does not recognise JSDoc on any Angular components nor does it recognise the JSDoc on the Storybook meta and stories either.

IgorPropisnov commented 12 months ago

I can confirm that this is still an issue on Storybook 7.1.0 and Angular 16. It does not recognise JSDoc on any Angular components nor does it recognise the JSDoc on the Storybook meta and stories either.

I have the same behavior, have you already found a solution for it?

richard-ncs commented 12 months ago

No. The only thing I've been doing for now is adding parameter descriptions where necessary. I feel that if its not fixed soon I may have to move to building custom MDX pages for each set of stories

ktschmincke commented 7 months ago

I am still experiencing this issue with Angular 16 and Storybook 7.6.4

Ruslan207 commented 7 months ago

same with angular 16.1.2 and storybook 7.6.6

ktschmincke commented 6 months ago

I fixed my issue. Once I properly configured compodoc with my project the autodocs started working: https://storybook.js.org/docs/essentials/controls#controls-are-not-automatically-generated-for-my-component

bastiW commented 6 months ago

@valentinpalkovic Thanks for fixing the bug in 7.6.4!

It works when I have the components & storybook within the same repository. When I use a NPM Angular Monorepro (no learna or NX) it does not show the docs.

The project structure looks like this:

package.json

  "workspaces": [
    "projects/my-library",
    "projects/my-storybook"
  ],

Do I need to configure / install something inside the my-library folder, so that projects/my-storybook can use the documentation?

valentinpalkovic commented 6 months ago

@bastiW The issue is that compodoc only processes components inside the current working directory (process.cwd). There is no option currently available to configure the src folder for compodoc.

If you want to tackle this issue, you would have to change this line:https://github.com/storybookjs/storybook/blob/next/code/frameworks/angular/src/builders/utils/run-compodoc.ts#L34

Maybe we can enhance the current logic around compodocArgs. The default for the compodocArgs options is currently ["-e", "json"]. We could say that the last item in the list defines the src folder (the default could be: ["-e", "json", "."]. In your particular case, it would be the workspace root. Then, we would remove the line. If you want to tackle this issue, you would have to change this line:https://github.com/storybookjs/storybook/blob/next/code/frameworks/angular/src/builders/utils/run-compodoc.ts#L34 and the final finalCompodocArgs must have to include the src folder as well.

Would you like to tackle this? I could support you if there are any questions.

@markb WDYT? Any concerns?

bastiW commented 6 months ago

I will give it try.

bastiW commented 6 months ago

@valentinpalkovic Having some issues to start the angular sandbox.

Could you please help? https://discord.com/channels/486522875931656193/839297503446695956/1197203506663260211