0.6.22 • Published 2 years ago

@lwce/lwc-storybook-cli v0.6.22

Weekly downloads
-
License
BSD-3-Clause
Repository
-
Last release
2 years ago

LWC Storybook CLI

A CLI tool for quickly getting started with storybook in LWC projects

Getting started

  1. Add lwc-storybook-cli as a dependency to your project:
npm install --save-dev @lwce/lwc-storybook-cli

# OR

yarn add --dev @lwce/lwc-storybook-cli
  1. Add to your package.json:
"scripts": {
  "storybook:build": "lwc-storybook build",
  "storybook:start": "lwc-storybook start",
}
  1. Make sure your lwc.config.json has the following module entry:
"modules": [
    ...
    {
        "npm": "lwc-components-lightning"
    }
],
  1. Optionally, add a mocked-core-modules-data.js file to the root of your project. The file should export a single getData function:
export function getData() {
    return {
        // Any data defined will be provided to the mocked core modules
    }
}
  1. Add .storybook to your .gitignore

Commands

start

Start storybook in development mode

Command: lwc-storybook start

build

Build storybook with an output that can be hosted on a static web server. Defaults the output to .storybook/build/public

Command: lwc-storybook build

story

Follow the prompts to generate a story

Command: lwc-storybook story