Generating Library Documentation from exported .svelte files #6991
Unanswered
yoh-extradat
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We have been building several component libraries for internal usage lately and are now contemplating the best way to document them. Since i am too lazy to write down stuff that's already in the source files and keep the documentation in sync with code changes afterwards, i would love to generate the documentation from the code.
On my wish list would be something like this:
npx docs init
docs generate
I've been doing a bit of research and found several smaller libraries. But so far i haven't found a solution, that doesn't require me to declare all component paths manually and/or write a lot of text that could be generated from the source files.
Thus I've started to setup some rudimentary generator scripts reading and parsing the source files. So far it's looking quite good and seems like it can be done in a straight forward way.
I am inspecting ./src/lib/index.ts to retrieve the path of all .svelte Files that are exported by the Library. Afterwards i read and parse all Files and extract Events, Slots and Properties including their types and defaults. The only thing that's a bit more tricky are descriptions. But they could be added via comment's.
Before going further down this path, i would appreciate some feedback. Is there a script for this, i've missed? Would any else be interessted in such a documentation generator?
Beta Was this translation helpful? Give feedback.
All reactions