diff --git a/.circleci/config.yml b/.circleci/config.yml index 29b3963fa0a..a75956d9c4d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -283,7 +283,7 @@ jobs: command: | cd code yarn coverage - chromatic-storybook-ui: + chromatic-internal-storybooks: executor: class: medium+ name: sb_node_16_browsers @@ -297,6 +297,7 @@ jobs: command: | cd code yarn storybook:ui:chromatic + yarn storybook:blocks:chromatic - store_test_results: path: test-results ## new workflow @@ -418,7 +419,7 @@ workflows: - script-unit-tests: requires: - build - - chromatic-storybook-ui: + - chromatic-internal-storybooks: requires: - build - coverage: diff --git a/MIGRATION.md b/MIGRATION.md index a76edffe8f8..4fb9d337c3f 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -2,9 +2,8 @@ - [From version 6.5.x to 7.0.0](#from-version-65x-to-700) - [Alpha release notes](#alpha-release-notes) - - [Breaking changes](#breaking-changes) + - [7.0 breaking changes](#70-breaking-changes) - [register.js removed](#registerjs-removed) - - [`Story` type change to `StoryFn`, and the new `Story` type now refers to `StoryObj`](#story-type-change-to-storyfn-and-the-new-story-type-now-refers-to-storyobj) - [Change of root html IDs](#change-of-root-html-ids) - [No more default export from `@storybook/addons`](#no-more-default-export-from-storybookaddons) - [Modern browser support](#modern-browser-support) @@ -38,11 +37,12 @@ - [External Docs](#external-docs) - [MDX2 upgrade](#mdx2-upgrade) - [Dropped addon-docs manual configuration](#dropped-addon-docs-manual-configuration) + - [7.0 Deprecations](#70-deprecations) + - [`Story` type deprecated](#story-type-deprecated) - [From version 6.4.x to 6.5.0](#from-version-64x-to-650) - [Vue 3 upgrade](#vue-3-upgrade) - [React18 new root API](#react18-new-root-api) - [Renamed isToolshown to showToolbar](#renamed-istoolshown-to-showtoolbar) - - [Deprecated register.js](#deprecated-registerjs) - [Dropped support for addon-actions addDecorators](#dropped-support-for-addon-actions-adddecorators) - [Vite builder renamed](#vite-builder-renamed) - [Docs framework refactor for React](#docs-framework-refactor-for-react) @@ -51,6 +51,8 @@ - [Auto-title filename case](#auto-title-filename-case) - [Auto-title redundant filename](#auto-title-redundant-filename) - [Auto-title always prefixes](#auto-title-always-prefixes) + - [6.5 Deprecations](#65-deprecations) + - [Deprecated register.js](#deprecated-registerjs) - [From version 6.3.x to 6.4.0](#from-version-63x-to-640) - [Automigrate](#automigrate) - [CRA5 upgrade](#cra5-upgrade) @@ -247,7 +249,7 @@ Storybook 7.0 is in early alpha. During the alpha, we are making a large number In the meantime, these migration notes are the best available documentation on things you should know upgrading to 7.0. -### Breaking changes +### 7.0 breaking changes #### register.js removed @@ -257,46 +259,6 @@ In 7.0, most of Storybook's addons now export a `manager.js` entry point, which If your `.manager.js` config references `register.js` of any of the following addons, you can remove it: `a11y`, `actions`, `backgrounds`, `controls`, `interactions`, `jest`, `links`, `measure`, `outline`, `toolbars`, `viewport`. -#### `Story` type change to `StoryFn`, and the new `Story` type now refers to `StoryObj` - -In 6.x you were able to do this: - -```js -import type { Story } from '@storybook/react'; - -export const MyStory: Story = () =>
; -``` - -But this will produce an error in 7.0 because `Story` is now a type that refers to the `StoryObj` type. -You must now use the new `StoryFn` type: - -```js -import type { StoryFn } from '@storybook/react'; - -export const MyStory: StoryFn = () =>
; -``` - -This change was done to improve the experience of writing CSF3 stories, which is the recommended way of writing stories in 7.0: - -```js -import type { Story } from '@storybook/react'; -import { Button, ButtonProps } from './Button'; - -export default { - component: Button, -}; - -export const Primary: Story = { - variant: 'primary', -}; -``` - -If you want to be explicit, you can also import `StoryObj` instead of `Story`, they are the same type. - -For Storybook for react users: We also changed `ComponentStory` to refer to `ComponentStoryObj` instead of `ComponentStoryFn`, so if you were using `ComponentStory` you should now import/use `ComponentStoryFn` instead. - -You can read more about the CSF3 format here: https://storybook.js.org/blog/component-story-format-3-0/ - #### Change of root html IDs The root ID unto which storybook renders stories is renamed from `root` to `#storybook-root` to avoid conflicts with user's code. @@ -751,6 +713,55 @@ As part of the upgrade we deleted the codemod `mdx-to-csf` and will be replacing Storybook Docs 5.x shipped with instructions for how to manually configure webpack and storybook without the use of Storybook's "presets" feature. Over time, these docs went out of sync. Now in Storybook 7 we have removed support for manual configuration entirely. +### 7.0 Deprecations + +#### `Story` type deprecated + +In 6.x you were able to do this: + +```ts +import type { Story } from '@storybook/react'; + +export const MyStory: Story = () =>
; +``` + +But this will produce a deprecation warning in 7.0 because `Story` has been deprecated. +To fix the deprecation warning, use the `StoryFn` type: + +```ts +import type { StoryFn } from '@storybook/react'; + +export const MyStory: StoryFn = () =>
; +``` + +This change is part of our move to CSF3, which uses objects instead of functions to represent stories. +You can read more about the CSF3 format here: https://storybook.js.org/blog/component-story-format-3-0/ + +#### `ComponentStory`, `ComponentStoryObj`, `ComponentStoryFn` and `ComponentMeta` types are deprecated + +The type of StoryObj and StoryFn have been changed in 7.0 so that both the "component" as "the props of the component" will be accepted as the generic parameter. + +```ts +import type { Story } from '@storybook/react'; +import { Button, ButtonProps } from './Button'; + +// This works in 7.0, making the ComponentX types redundant. +const meta: Meta = { component: Button }; + +export const CSF3Story: StoryObj = { args: { label: 'Label' } }; + +export const CSF2Story: StoryFn = (args) =>