
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
babel-plugin-generate-stories
Advanced tools
Automatically generate storybook stories for your react components without writing a single line of additional code.
# 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
}
]
]
}
option | description | default |
---|---|---|
targetDir | the target directory for the stories, in most cases you'll want to set this to a .storybook/stories directory | ".storybook/stories" |
withThemeit | automatically generate a story for each react-themeit theme of a component. | false |
withKnobs | add 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 |
debug | will log debug messages (e.g. "Generated story for ...") | false |
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
Contributions are very welcome!
FAQs
Automatically generates stories for use with storybook.
We found that babel-plugin-generate-stories demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.