Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Storybook 7 Migration Summary #1946

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
66 changes: 66 additions & 0 deletions storybook-migration-summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Storybook 7 Migration Summary

## Upgrade Storybook packages

The following command was ran to upgrade the Storybook packages:

```bash
npx storybook@latest upgrade
```

## Your `.storybook/main.js|ts` files were prepared for Storybook's automigration scripts

Some adjustments were made to your `.storybook/main.js|ts` files so that
the Storybook automigration scripts could run successfully. The changes that were made are as follows:

- Remove the `as StorybookConfig` typecast from the main.ts files, if any,
since it is not needed any more.
- Remove the `path.resolve` calls from the Next.js Storybook configuration, if any, since it breaks the Storybook automigration scripts.

## The Storybook automigration scripts were ran

### Some migrations failed

The following commands failed and your Storybook configuration for these projects was not
migrated to the latest version 7:

- `npx storybook@latest automigrate --config-dir libs/ui/.storybook --renderer @storybook/angular`

You can run these commands again, manually, and follow the instructions in the
output of these commands to migrate your Storybook configuration to the latest version 7.

Also, we may have missed something. Please make sure to check the logs of the Storybook CLI commands that were run, and look for
the `❌ Failed trying to evaluate` message or `❌ The migration failed to update` message. This will indicate if a command was
unsuccessful, and will help you run the migration again, manually.

## Final adjustments

After the Storybook automigration scripts have run, some additional adjustments were made to your
workspace, to make sure that everything is working as expected. These adjustments are as follows:

- The `vite-tsconfig-paths` plugin was removed from the Storybook configuration files since it's no longer needed.
- The `viteConfigPath` option was added to the Storybook builder, where needed.
- The import package for the `StorybookConfig` type was changed to be framework specific.
- The `uiFramework` option was removed from your project's Storybook targets.
- The `lit` package was added to your workspace, if you are using the
Web Components `@storybook/web-components` package. Please note that the `lit-html` package is
no longer needed by Storybook v7. So, if you are not using it anywhere else, you can safely remove it.

## Next steps

You can make sure everything is working as expected by trying
to build or serve your Storybook as you normally would.

```bash
npx nx build-storybook project-name
```

```bash
npx nx storybook project-name
```

Please read the [Storybook 7.0.0 release article](https://storybook.js.org/blog/storybook-7-0/) and the
official [Storybook 7.0.0 migration guide](https://storybook.js.org/docs/react/migration-guide)
for more information.

You can also read the docs for the [@nx/storybook:migrate-7 generator](https://nx.dev/packages/storybook/generators/migrate-7) and our [Storybook 7 setup guide](https://nx.dev/packages/storybook/documents/storybook-7-setup).