Description
We need to provide a clear way for library authors on how to build a Svelte component library, ideally with CLI support and conventions. My idea for a solution is this:
The very first step of create-svelte
is to ask whether you want to build an app or a component library. Depending on that, different templates are used.
It would also be good to have some way of testing out the library yourself, so maybe we could have some kind of showcase
folder where you can try out the components; this folder would be ignored when building/bundling the library. Generation of such a folder should be optional, though, because library authors might do it differently.
It would also be good to have support for TypeScript. There's some new package for generating types from the Svelte components called svelte2dts which we could use for it. If it works well, we can also ask the maintainer to move the package into language-tools
and make it official.
In general, it might be good to get some feedback from library authors on what they like currently and what they need.
Further reading:
- Angular does this through the CLI and a predefined folder-structure. They have
app
where your application lives andprojects
where you can add libraries, each with a predefined folder structure. - React has no official stance on this AFAIK, but there's a community CLI to setup something for you
- [please add more if you know of other solutions]