title | sidebar | ||||
---|---|---|---|---|---|
Upgrading Storybook |
|
The frontend ecosystem is a fast-moving place. Regular dependency upgrades are a way of life, whether upgrading a framework, library, tooling, or all of the above! Storybook provides a few resources to help ease the pain of upgrading.
The most common upgrade is Storybook itself. Storybook releases follow Semantic Versioning. We publish patch releases with bug fixes continuously, minor versions of Storybook with new features every few months, and major versions of Storybook with breaking changes roughly once per year.
To help ease the pain of keeping Storybook up-to-date, we provide a command-line script:
{/* prettier-ignore-start */}
{/* prettier-ignore-end */}
The upgrade
command will use whichever version you specify. For example:
storybook@latest upgrade
will upgrade to the latest version[email protected] upgrade
will upgrade to7.6.10
storybook@7 upgrade
will upgrade to the newest7.x.x
version
After running the command, the script will:
- Upgrade all Storybook packages in your project to the specified version
- Run the relevant automigrations factoring in the breaking changes between your current version and the specified version
To help you verify that the upgrade was completed and that your project is still working as expected, the Storybook CLI provides the doctor
command that allows you to do a health check on your project for common issues that might arise after an upgrade, such as duplicated dependencies, incompatible addons or mismatched versions. To perform the health check, run the following command with your package manager of choice:
{/* prettier-ignore-start */}
{/* prettier-ignore-end */}
Storybook upgrades are not the only thing to consider: changes in the ecosystem also present challenges. For example well-known frontend frameworks, such as Angular, Next.js or Svelte have been rolling out significant changes to their ecosystem, so even if you don't upgrade your Storybook version, you might need to update your configuration accordingly. That's what Automigrate is for:
{/* prettier-ignore-start */}
{/* prettier-ignore-end */}
It runs a set of standard configuration checks, explains what is potentially out-of-date, and offers to fix it for you automatically. It also points to the relevant documentation so you can learn more. It runs automatically as part of storybook upgrade
command, but it's also available on its own if you don't want to upgrade Storybook.
In addition to the above, Storybook is under constant development, and we publish pre-release versions almost daily. Pre-releases are the best way to try out new features before they are generally available, and we do our best to keep them as stable as possible, although this is not always possible.
To upgrade to the latest pre-release:
{/* prettier-ignore-start */}
{/* prettier-ignore-end */}
The upgrade
command will use whichever version you specify. For example:
storybook@next upgrade
will upgrade to the newest pre-release version[email protected] upgrade
will upgrade to8.0.0-beta.1
storybook@8 upgrade
will upgrade to the newest8.x
version
If you'd like to downgrade to a stable version, manually edit the package version numbers in your package.json
and re-install.
If you're attempting to upgrade Storybook to the latest version in your existing Vue 2 project, you will no longer be able to. This is because Vue 2 entered End of Life (EOL) on December 31st, 2023, and will no longer receive any updates from the Vue team. We recommend you upgrade your Vue 2 project to Vue 3 and then upgrade Storybook to the latest version. If you cannot upgrade your Vue 2 project to Vue 3, you can still upgrade Storybook, but only for the latest 7.x version. You can do this by running the following command:
{/* prettier-ignore-start */}
{/* prettier-ignore-end */}