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

Automigrations: Enhance experience for upgrades from Storybook 6 to 8 #26067

Merged
merged 26 commits into from
Feb 27, 2024

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Feb 16, 2024

Closes #26032, closes #25975, closes #25989

What I did

Added version range checks to all automigrations to ensure that the automigrations only run for particular version upgrades. For example, upgrade from 6 to 8 or 7 to 8. The version check only happens during npx storybook upgrade and not during npx storybook automigrate.

The following auto migrations were removed in Storybook 8 because they aren't necessary anymore:

  • incompatible-addons (Storybook doctor covers this)
  • vite-4 (added an autoblocker)

Additionally, I have optimized the logic of how the Storybook version is evaluated so that it is also compatible with Storybook 6.

Checklist for Contributors

Testing

Storybook 6

  1. Checkout a Storybook 6 Repository (e.g. https://github.com/RocketCommunicationsInc/astro/tree/main/packages/web-components)
  2. Run npx [email protected] upgrade

Make sure that only the following automigrations were triggered when applicable:

  • angular-builders-multiproject
  • angular-builders
  • autodocsTrue
  • bare-mdx-stories-glob
  • builder-vite
  • cra5
  • eslintPlugin
  • mdx1to3
  • github-flavored-markdown-mdx
  • new-frameworks
  • react-docgen
  • remove-argtypes-regex
  • removedglobalclientapis
  • remove-jest-testing-library
  • storybook-binary
  • sb-scripts
  • storyshots-migration
  • viteConfigFile
  • vue3
  • webpack5-compiler-setup
  • webpack5
  • wrap-require

Storybook 7

  1. Checkout a Storybook 7 Repository
  2. Run npx [email protected] upgrade

Make sure that only the following automigrations were triggered when applicable:

  • eslintPlugin
  • react-docgen
  • remove-argtypes-regex
  • remove-jest-testing-library
  • storyshots-migration
  • viteConfigFile
  • webpack5-compiler-setup

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Test Results - Freecodecamp (React - SB6.5.16)

The following automigrations got triggered:

new-frameworks, storybook-binary, sb-scripts, github-flavored-markdown-mdx, autodocsTrue, react-docgen
webpack5-compiler-setup, mdx1to3

Issues:

  • The user will not get notified, that @storybook/addon-postcss doesn't work anymore with Storybook 8
  • The bare-mdx-stories-glob codemod isn't applied automatically, which it should
  • The @storybook/addons doesn't exist anymore. This is not caught be automigrations. Manual migration required.
  • The mdx1-to-3 automigration doesn't link to a 6-to-8 migration document
  • The Introduction.stories.mdx file gets transformed from the bare-mdx-stories-glob codemod to this:
import Code from './assets/code-brackets.svg';
import Colors from './assets/colors.svg';
import Comments from './assets/comments.svg';
import Direction from './assets/direction.svg';
import Flow from './assets/flow.svg';
import Plugin from './assets/plugin.svg';
import Repo from './assets/repo.svg';
import StackAlt from './assets/stackalt.svg';

export default {
  title: 'Example/Introduction'
};

The codemod should actually not create a stories.ts file, if there are actually no components.

Test Results - Astro UXDS Web Component (Web Components - SB6.4.22)

Issues:

Test Results - Mealdrop (React SB7.6.0)

The following automigrations got triggered

github-flavored-markdown-mdx, remove-argtypes-regex

Test Results - In General

All major package managers (yarn 1, yarn berry, npm and pnpm) were tested to ensure version detection works.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This pull request has been released as version 0.0.0-pr-26067-sha-847cb0b0. Try it out in a new sandbox by running npx [email protected] sandbox or in an existing project with npx [email protected] upgrade.

More information
Published version 0.0.0-pr-26067-sha-847cb0b0
Triggered by @valentinpalkovic
Repository storybookjs/storybook
Branch valentin/6-to-8-automigrations
Commit 847cb0b0
Datetime Mon Feb 19 09:46:08 UTC 2024 (1708335968)
Workflow run 7957547061

To request a new release of this pull request, mention the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=26067

@valentinpalkovic valentinpalkovic changed the title Valentin/6 to 8 automigrations Automigrations: Enhance experience for Automigrations from 6 to 8 Feb 16, 2024
@valentinpalkovic valentinpalkovic changed the title Automigrations: Enhance experience for Automigrations from 6 to 8 Automigrations: Enhance experience for upgrades from Storybook 6 to 8 Feb 16, 2024
@valentinpalkovic valentinpalkovic self-assigned this Feb 16, 2024
@valentinpalkovic valentinpalkovic force-pushed the valentin/6-to-8-automigrations branch from 0c4f704 to 05ebcc2 Compare February 16, 2024 13:40
@valentinpalkovic valentinpalkovic force-pushed the valentin/6-to-8-automigrations branch from 05ebcc2 to e1ba87c Compare February 16, 2024 13:43
@valentinpalkovic valentinpalkovic force-pushed the valentin/6-to-8-automigrations branch from 8da1b98 to 3770642 Compare February 19, 2024 07:10
@valentinpalkovic valentinpalkovic force-pushed the valentin/6-to-8-automigrations branch from f85be76 to 609482b Compare February 20, 2024 11:15
@valentinpalkovic valentinpalkovic force-pushed the valentin/6-to-8-automigrations branch from f99173d to b481b3f Compare February 23, 2024 09:19
@valentinpalkovic valentinpalkovic marked this pull request as ready for review February 26, 2024 14:27
Copy link
Member

@yannbf yannbf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@yannbf yannbf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@storybookjs storybookjs deleted a comment from yannbf Feb 27, 2024
@valentinpalkovic valentinpalkovic merged commit 6de6753 into next Feb 27, 2024
58 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/6-to-8-automigrations branch February 27, 2024 14:00
@github-actions github-actions bot mentioned this pull request Feb 27, 2024
30 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants