Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

babel-plugin-generate-stories

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-generate-stories

Automatically generates stories for use with storybook.

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

babel-plugin-generate-stories

NPM Version Build Status License

Automatically generate storybook stories for your react components without writing a single line of additional code.

Installation

# with yarn
yarn add -D babel-plugin-generate-stories

# with npm
npm i -D babel-plugin-generate-stories

In your .babelrc

{
  "plugins": [
    [
      "generate-stories",
      {
        "targetDir": ".stories",
        "withThemeit": true,
        "withKnobs": true,
        "debug": true
      }
    ]
  ]
}
optiondescriptiondefault
targetDirthe target directory for the stories, in most cases you'll want to set this to a .storybook/stories directory".storybook/stories"
withThemeitautomatically generate a story for each react-themeit theme of a component.false
withKnobsadd the @storybook/addon-knobs and storybook-addon-smart-knobs decorators to your stories to display editable component props in the storybook where possible - to use this feature you must install both packages!true
debugwill log debug messages (e.g. "Generated story for ...")false

Usage

Whenever you have a component which you would like to automatically generate stories for, include a comment like this:

// @storybook

preferrably at the top of the file. The will be picked up by this plugin and trigger the generation of the story.

By default the default export will be used for the stories. If you want to create a story for something that is not exported as the default export, you may use the syntax below to let the plugin know which export it should use for the story.

// @storybook MyComponent

Maintainers

flipace

Contributions are very welcome!

License

MIT License

FAQs

Package last updated on 23 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts