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 🙏

© 2024 – Pkg Stats / Ryan Hefner

lwc-demo

v0.0.1

Published

Generate Lightning web component documentation.

Downloads

4

Readme

Lightning web component Demo Generator

Focus on writing your Lightining web components and leave the documentation generation to lwc-demo. Features include:

  • Built with LWC!
  • Ideal for https://github.io
  • Easy to navigte with a mobile friendly design
  • JSdoc parsing
  • Markdown with smart defaults
git clone lwc-demo
cd lwc-demo
npm install
npm link ../path-to-module
npm link module-name
npm run watch

Learn more about npm link. This will allow live reload of a local component.

When you are ready to generate the static website...

  • npm run build
  • Copy the contents of the dist folder.

Documentation

This uses webpack to read everything and generate documentation from various jsdoc comments in your code and markdown files. Examples for each file and their location described below.

JSdoc

src/modules/namespace/name/name.js   <namespace-name>

Using JSdoc can be a great way to document your component inside of the JavaScript file.

Class

/**
 * Render a name component.
 * 
 * > **Note:** Parsed with markdown!
 * 
 * @order 1
 */
export default class Name extends LightningElement { }

Order: Set priority of component on the page.

Attribute (@api)

By default @api is the main form of documentation. Any other properties or methods will be ignored.

/**
  * The path data rendered in the SVG.
  *
  * @type {string}
  * @default 'Hello World'
  */
@api foo = 'Hello World';

Namespace Markdown File (recommended)

src/modules/namespace/namespace.md

Introducing your namespace is a great way explain the relationship between the components.

# Override `namespace`

This namespace contains components to help with your app.

[icon]: M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z
[order]: 1

Icon: Icon is an optional single pathed SVG file. Use any icon from MaterialDesignIcons.com. Defaults to puzzle-outline. Order: For multiple namespaces set a priority.

Component Markdown File (optional)

src/modules/namespace/name/name.md

By default the JSdoc description above the component class will be used. To not clutter the JS file one can used a markdown file to override the title, description, or order.

# Override Component Title

Override the JSdoc description. Ideal for teams that do not want to clutter their files.

[order]: 1

Examples __examples__ (required)

Examples are great way to explain what @api in your component will do. Including one example for every @api is recommended.

src/modules/namespace/name/__examples__/withFoo/withFoo.js
                                               /withFoo.html
                                               /withFoo.css

JSdoc (recommended)

JSdoc at the top of your WithFoo class will be used.

/**
 * This example sets the foo attribute.
 *
 * @order 1
 */
export default class WithFoo extends LightningElement { }

Order: Set example order. Useful for showing basic examples first.

Markdown (optional)

You can override anything in the JSdoc with a markdown file the withFoo folder.

Tests __tests__ (optional)

Want to show off your components tests. Test counts if found will show to the right of the header. Clicking will navigate the user to your GitHub repo's spec file.

WDIO __wdio__ (optional)

Similar to tests it is highly encouraged to provide integration testing. These will appear to the right in the header if found.

Theme

Themes are managed through several dynamic components.

<demo-title
 path={namespace.icon}
 label={component.name}></demo-title>
<demo-description
  namespace={component.namespace}></demo-description>
<demo-component-title
  namespace={component.namespace}
  component={component}></demo-component-title>
<demo-component-description
  namespace={component.namespace}
  component={component}></demo-component-description>
<demo-example-title
  namespace={component.namespace}
  component={component}
  example={name}></demo-example-title>
<demo-example-description
  namespace={component.namespace}
  component={component}
  example={name}></demo-example-description>
<demo-example
  namespace={component.namespace}
  component={component}
  example={name}></demo-example>