Storybook provides an upgrade command that allows you to upgrade your Storybook dependencies and configuration files.
Using the Storybook CLI to upgrade
Section titled “Using the Storybook CLI to upgrade”Upgrade Storybook
Section titled “Upgrade Storybook”In the root directory of your workspace, run:
npx storybook@latest upgrade
Let Nx handle the migrations
Section titled “Let Nx handle the migrations”After you run the Storybook CLI upgrade command, Nx will automatically run any necessary migrations to update your Storybook configuration files and dependencies.
Manual upgrade path
Section titled “Manual upgrade path”If you prefer to upgrade manually, you can:
- Update your Storybook dependencies in your
package.json
- Run
npm install
or your preferred package manager - Update your Storybook configuration files according to the Storybook migration guide
Nx Storybook migrations
Section titled “Nx Storybook migrations”Nx provides migrations for major Storybook updates. These migrations are automatically triggered when you update your Nx version. The migrations help with:
- Updating Storybook configuration files
- Updating dependencies
- Migrating to new Storybook features
- Fixing breaking changes
Troubleshooting upgrades
Section titled “Troubleshooting upgrades”If you encounter issues during the upgrade:
- Check the Storybook migration guide for framework-specific changes
- Review the Nx Storybook documentation for Nx-specific configurations
- Check the console output for specific error messages and fix them accordingly
Upgrading to Storybook 7+
Section titled “Upgrading to Storybook 7+”For major version upgrades (like Storybook 6 to 7), make sure to:
- Review the breaking changes in the Storybook release notes
- Update your stories to use the new APIs if needed
- Test your Storybook instances after the upgrade
- Update any custom configurations or addons
Remember to test your Storybook instances thoroughly after any upgrade to ensure everything works as expected.