npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

svelte-doc-generator

v1.2.1

Published

Do you have a library of svelte components? You can generate a documentation for whole your library.

Readme

Svelte documentation generator tool

Do you have a library of svelte components? You can generate a documentation for whole your library.

example

Installation

1. Install the package

npm install --save-dev svelte-doc-generator

2. Run setup tool

This will create webpack.config.js, package.json and site folder inside your project. You can just copy and paste this files into your project from template folder. You you already have package.json or webpack.config.js, just yours with from template ones.

node ./node_modules/.bin/svelte-doc-generator setup --project .

3. Create sample documentation component

For every component you want to create document for you have to create *Documentation.svelte file inside the component folder. Imagine that you have folder ./src/components/Input with component Input.svelte. Inside ./src/components/Input folder you have to create InputDocumentation.svelte like this:

<script>
  import { Component } from 'svelte-doc-generator';
  import Input from './Input.svelte';
</script>

<Component title="Input">
  <div slot="description">
    Component to draw inputs easily.
  </div>

  <div slot="usages">
    <Component.Usage title="Default state">
      <Input />
    </Component.Usage>
  </div>
</Component>

4. Generate documentation library

This will generate a library from your components. This tool will include only components with *Documentation.svelte files inside.

node ./node_modules/.bin/svelte-doc-gnerator generate --library ./src/components --target ./site/library

Or run documentation changes watcher to regenerate documentation on every change inside your library documentations components.

node ./node_modules/.bin/svelte-doc-gnerator watch --library ./src/components --target ./site/library

5. Run your documentation site

This command will start webpack dev server to serve your site.

node ./node_modules/webpack-dev-server/.bin/webpack-dev-server.js --mode development

6. Open localhost

Open localhost:8080 in your browser and take a look at the result!

Full example

Take a look at the CheckboxGroupDocumentation.svelte example below. Do not take in mind CheckboxGroup component.

<script>
  import { Component } from 'svelte-doc-generator';
  import CheckboxGroup from './index';

  const checkboxes = [
    {
      label: 'Можно с животными',
      id: 'animals-are-allowed',
      value: 'animalsAreAllowed'
    },
    {
      label: 'Можно с детьми',
      id: 'kids-are-allowed',
      value: 'kidsAreAllowed'
    }
  ];

  const source = `const checkboxes = ${JSON.stringify(checkboxes, null, 2)};`;
</script>

<Component title="Checkbox group">
  <div slot="description">
    Component to draw grouped checkboxes.
    <br/>
    <br/><Component.Code {source} lang="javascript" />
  </div>

  <div slot="usages">
    <Component.Usage title="Default checkboxes group">
      <CheckboxGroup {checkboxes} />
    </Component.Usage>
  </div>
</Component>

This code will generate the following output. example

TODO

  • [ ] Create documentation for every exported svelte component.