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

Storybook support #5397

Closed
benmccann opened this issue Jul 6, 2022 · 11 comments · Fixed by #8138
Closed

Storybook support #5397

benmccann opened this issue Jul 6, 2022 · 11 comments · Fixed by #8138
Labels
feature request New feature or request
Milestone

Comments

@benmccann
Copy link
Member

benmccann commented Jul 6, 2022

Describe the problem

Storybook mostly works now, but there's still some things that can be cleaned up. Opening this as a tracking issue for the various pending PRs

Describe the proposed solution

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

@benmccann benmccann added the feature request New feature or request label Jul 6, 2022
@GauBen
Copy link
Contributor

GauBen commented Jul 6, 2022

I ran into this very issue this morning, and after a bit of trial and error, I managed to have a working configuration: windicss/windicss#267 (comment)

I'll try to contribute to svelte-add.

@benmccann
Copy link
Member Author

I think rather than creating a new Svelte adder it may make more sense to fix npx sb init, which does the same thing

@IanVS
Copy link

IanVS commented Jul 7, 2022

For sb init, you have remove need for yarn. There is some logic to detect the package manager in use based on the lockfile, but I've seen it fail sometimes and try to use yarn in npm projects. It can be forced using --use-npm, but there's no --use-pnpm.

@benmccann
Copy link
Member Author

I somehow had an empty yarn.lock file in my home directory that the generator was picking up on. I removed that and it's working now

@benbender
Copy link

Thanks for this combined effort! 🎉

The last missing piece, after all those changes have landed, will be some kind of docgen-extraction for ts-types inside of svelte-components, right?

The different storybook-svelte-packages (and more) are using https://github.com/alexprey/sveltedoc-parser which seems quite dead atm and, sadly, never finished support of doc-extraction of ts-components. Last time I checked there wasn't any complete/working solution for this problem.

That's not really specific for storybook, but more a lack in the svelte-ecosystem.
Any plans to tackle that too?

@IanVS
Copy link

IanVS commented Jul 21, 2022

I wonder if some of https://github.com/styleguidist/react-docgen-typescript could be used as a starting point / reference to add sveltedoc-parser typescript support. There was already some work in KatChaotic/sveltedoc-parser@dev...typescript-support, I hope someone will be willing to fork the project and continue working on adding support. It seems like it would benefit much of the ecosystem.

@GauBen
Copy link
Contributor

GauBen commented Jul 21, 2022

The svelte language tools probably contain all that's needed to extract the documentation, given that it works in vscode:

image

image

@dummdidumm
Copy link
Member

Yes and no - we rely on typescript to show all of this, not sure how we could intercept this cleverly to get what we want. However, we indeed have some kind of extraction going on, which could be reused to achieve this. svelte2tsx is the package where it would be implemented

@IanVS
Copy link

IanVS commented Jul 21, 2022

I mentioned svelte2tsx in the sveltedoc-parser typescript issue a while back, with no response. @dummdidumm what do you envision would need to be done to achieve docgen from svelte typescript?

@benmccann
Copy link
Member Author

benmccann commented Dec 13, 2022

Storybook 7 will have SvelteKit support:
https://storybook.js.org/blog/storybook-for-sveltekit/
https://github.com/storybookjs/storybook/blob/next/code/frameworks/sveltekit/README.md

@ciscorn
Copy link

ciscorn commented Jul 9, 2024

I just submitted a PR to introduce an approach using svelte2tsx and TypeScript.
storybookjs/storybook#28492

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants