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

Docs: Update migration guide for 8.0 #25569

Merged
merged 6 commits into from
Jan 25, 2024
Merged

Docs: Update migration guide for 8.0 #25569

merged 6 commits into from
Jan 25, 2024

Conversation

kylegach
Copy link
Contributor

What I did

Updated the official migration guide for 8.0

Checklist for Contributors

Testing

Manual testing

  1. Follow the steps in the contributing instructions for this branch, docs-migration-8

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 PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

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

@kylegach kylegach added documentation ci:docs Run the CI jobs for documentation checks only. labels Jan 11, 2024
@kylegach kylegach self-assigned this Jan 11, 2024
Copy link
Contributor

@jonniebigodes jonniebigodes left a comment

Choose a reason for hiding this comment

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

@kylegach aware that this is a draft pr which will be updated as we go, but left a couple of items for you to look into when able.

docs/migration-guide.md Outdated Show resolved Hide resolved
docs/migration-guide.md Outdated Show resolved Hide resolved
docs/migration-guide.md Show resolved Hide resolved
@kylegach kylegach force-pushed the docs-migration-8 branch 2 times, most recently from ea8ada9 to 0f8d085 Compare January 18, 2024 16:50
Copy link

@chantastic chantastic left a comment

Choose a reason for hiding this comment

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

This is a really nice doc. Well written and thoroughly referenced (with more specific links) ✅

docs/migration-guide.md Outdated Show resolved Hide resolved
docs/migration-guide.md Outdated Show resolved Hide resolved
docs/migration-guide.md Outdated Show resolved Hide resolved
docs/migration-guide.md Outdated Show resolved Hide resolved
docs/migration-guide.md Outdated Show resolved Hide resolved
@yannbf
Copy link
Member

yannbf commented Jan 22, 2024

I foresee people migrating from Storybook 6 to 8 (seems like over 30% of the npm downloads are v6). So what does this PR mean for people who are looking for instructions from 6 to 7? Will they figure out that they need to switch versions in the docs so they get a sidebar entry for the Storybook 7 migration?


If any of these apply to your project, please read through the [full migration notes](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-65x-to-700) before continuing. If any of these new requirements or changes do not fit your project, you should probably stick with Storybook 6.x.
If any of these apply to your project, please read through the [full migration notes](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-7x-to-800) before continuing. If any of these new requirements or changes do not fit your project, you should probably stick with Storybook 7.x.
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why these changes necessitate a full read of the migration notes. I'd say that if any of these apply to your project, you should definitely read those sections in detail.

And everybody might benefit from reading the detailed notes before upgrading OR can try to upgrade and consult the detailed notes as they troubleshoot problems.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point!

We published a [detailed post about CSF3](https://storybook.js.org/blog/storybook-csf3-is-here/) including all of its benefits and migration steps.

If you want to just skip to the migration, we provide a codemod for your convenience which should automatically make the code changes for you (make sure to update the glob to fit your files):
Then, you can optionally convert CSF 2 to CSF 3 ([why should you do this?](https://storybook.js.org/blog/storybook-csf3-is-here/)):
Copy link
Member

Choose a reason for hiding this comment

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

Note that storiesOf-to-CSF converts to CSF1. There is no automated transformation from CSF 1 to 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shilman — Here's what I came up with:

# Convert storiesOf to CSF 1
npx storybook@latest migrate storiesof-to-csf --glob="**/*.stories.tsx" --parser=tsx

While stories written in CSF 1 are supported in Storybook 8, we recommend upgrading to CSF 3, which has significant benefits when writing and maintaining stories. You'll need to manually migrate your stories to CSF 2, and then you can use the codemod to automatically upgrade from CSF 2 to 3.

I don't love it. 😕 But we don't have any materials that go straight from CSF 1 to 3, and providing a true guide for that (step-by-step, with multiple renderer snippets) would be a ton of effort for a small set of users that will encounter this. Wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

@kylegach I don't know if there's much value in converting from 1 to 2 and then 2 to 3.

How about something like this:

# Convert storiesOf to CSF 1
npx storybook@latest migrate storiesof-to-csf --glob="**/*.stories.tsx" --parser=tsx

This will create your stories to CSF1 stories, which are story functions that don't accept args. These are fully supported in Storybook 8, and will continue to be for the foreseeable future. However, we recommend writing all new stories in CSF3, which are story objects that are easier to write, reuse, and maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My thinking was that CSF 1 (no args) to CSF 3 (implicit render functions, stories are objects, etc) would be quite a leap. So easier for the manual part to go to CSF 2, then let the automod handle it.

But I agree that it's weird.


Oh, I just caught the "all new stories" bit of your edit! That works for me. Thanks!


```sh
npx storybook@latest migrate csf-2-to-3 --glob="src/**/*.stories.js"
# Convert CSF 2 to CSF 3
Copy link
Member

Choose a reason for hiding this comment

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

You should probably add this in another section, where you give a brief explanation of CSF2 and why you should upgrade. Note that this is an optional migration, since CSF2 is still fully supported (as is CSF1).

@kylegach kylegach marked this pull request as ready for review January 25, 2024 16:05
@kylegach
Copy link
Contributor Author

@yannbf

I foresee people migrating from Storybook 6 to 8 (seems like over 30% of the npm downloads are v6). So what does this PR mean for people who are looking for instructions from 6 to 7? Will they figure out that they need to switch versions in the docs so they get a sidebar entry for the Storybook 7 migration?

That's what this section is for!

That link is versioned. 😎

kylegach and others added 4 commits January 25, 2024 13:44
- Clarify neccessity of reading migration notes in full vs. section
- Clarify that `storiesof-to-csf` codemod produces CSF 1
    - Add note about recommended upgrade to CSF 3
- Move CSF 2 to 3 upgrade to optional section
- Use existing snippets
- Fix typos
- Improve link URLs
@kylegach kylegach force-pushed the docs-migration-8 branch 2 times, most recently from a202567 to a755492 Compare January 25, 2024 20:47
- Update filenames to consistent convention
@kylegach kylegach merged commit 6fdd954 into next Jan 25, 2024
18 checks passed
@kylegach kylegach deleted the docs-migration-8 branch January 25, 2024 20:53
@github-actions github-actions bot mentioned this pull request Jan 25, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:docs Run the CI jobs for documentation checks only. documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants