What is @storybook/core-common?
The @storybook/core-common package is part of the Storybook ecosystem, which is a tool for developing UI components in isolation for React, Vue, Angular, and more. This package includes common functionalities and utilities used by various Storybook packages to configure and manage the core aspects of Storybook. It provides a set of APIs and configurations that are shared across different parts of the Storybook codebase.
What are @storybook/core-common's main functionalities?
Configuration Management
This feature allows developers to manage Storybook's configuration, including setting up the list of stories, adding addons, and customizing the Webpack configuration.
module.exports = { stories: ['../src/**/*.stories.js'], addons: ['@storybook/addon-actions', '@storybook/addon-links'], webpackFinal: async (config, { configType }) => { // Return the altered config return config; }, };
Preset Management
Preset management helps in merging custom configurations with Storybook's default configurations using utilities like mergeConfig.
const { mergeConfig } = require('@storybook/core-common'); module.exports = { addons: ['@storybook/addon-essentials'], webpackFinal: (config) => mergeConfig(config, customConfig), };
Custom Decorators and Parameters
Developers can use this package to add custom decorators and parameters to their Storybook setup, enhancing the functionality and customization of their stories.
const { addDecorator, addParameters } = require('@storybook/core-common'); addDecorator(myDecorator); addParameters({ myParameter: 'value' });
Other packages similar to @storybook/core-common
react-cosmos
React Cosmos is a development environment for creating reusable React components. It allows developers to render components with different props and states. While it shares the component isolation feature with Storybook, it does not have an extensive plugin system or the same level of community support.
docz
Docz leverages MDX to help you document your components with ease. It's similar to Storybook in that it provides a UI for showcasing components, but it focuses more on documentation and less on the interactive development environment aspect.