Skip to content

Commit f2a9f71

Browse files
Upgrade Storybook 8 to 10 (#24)
Run via the official upgrade CLI one major at a time with automigrations. Drop unused addons: essentials and interactions are core in Storybook 9+; links, docs and Chromatic were unused (no linkTo, MDX, autodocs, or Chromatic CI). This leaves storybook, @storybook/react-vite and eslint-plugin-storybook as the only Storybook dev dependencies. Exclude stories from the CJS build: Storybook 10 types don't resolve under node10 module resolution. The ESM build still typechecks them. Ignore generated docs/build in eslint: a new eslint-plugin-storybook rule flagged stale typedoc output there. Disable the onboarding checklist and what's new notifications. The lockfile is regenerated as npm could not resolve the major bumps in place.
1 parent 48b6a6c commit f2a9f71

10 files changed

Lines changed: 3070 additions & 3624 deletions

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
'plugin:react-hooks/recommended',
88
'plugin:storybook/recommended',
99
],
10-
ignorePatterns: ['dist', '.eslintrc.cjs'],
10+
ignorePatterns: ['dist', 'docs/build', '.eslintrc.cjs'],
1111
parser: '@typescript-eslint/parser',
1212
plugins: ['react-refresh'],
1313
rules: {

.storybook/main.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import type { StorybookConfig } from '@storybook/react-vite';
22

33
const config: StorybookConfig = {
44
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
5-
addons: [
6-
'@storybook/addon-links',
7-
'@storybook/addon-essentials',
8-
'@chromatic-com/storybook',
9-
'@storybook/addon-interactions',
10-
],
5+
features: {
6+
// No onboarding checklist in the sidebar or menu.
7+
sidebarOnboardingChecklist: false,
8+
menuOnboardingChecklist: false,
9+
},
10+
core: {
11+
disableWhatsNewNotifications: true,
12+
},
1113
framework: {
1214
name: '@storybook/react-vite',
1315
options: {},

.storybook/preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Preview } from "@storybook/react";
1+
import type { Preview } from "@storybook/react-vite";
22

33
const preview: Preview = {
44
parameters: {

package-lock.json

Lines changed: 3049 additions & 3601 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,17 @@
7070
"tslib": ">=2.0.0"
7171
},
7272
"devDependencies": {
73-
"@chromatic-com/storybook": "^1.9.0",
74-
"@storybook/addon-essentials": "^8.2.9",
75-
"@storybook/addon-interactions": "^8.2.9",
76-
"@storybook/addon-links": "^8.2.9",
77-
"@storybook/blocks": "^8.2.9",
78-
"@storybook/react": "^8.2.9",
79-
"@storybook/react-vite": "^8.2.9",
80-
"@storybook/test": "^8.2.9",
73+
"@storybook/react-vite": "^10.5.10",
8174
"@types/react": "^18.2.66",
8275
"@types/react-dom": "^18.2.22",
8376
"@typescript-eslint/eslint-plugin": "^7.2.0",
8477
"@typescript-eslint/parser": "^7.2.0",
8578
"eslint": "^8.57.0",
8679
"eslint-plugin-react-hooks": "^4.6.0",
8780
"eslint-plugin-react-refresh": "^0.4.6",
88-
"eslint-plugin-storybook": "^0.8.0",
81+
"eslint-plugin-storybook": "^10.5.10",
8982
"prettier": "^3.2.5",
90-
"storybook": "^8.2.9",
83+
"storybook": "^10.5.10",
9184
"tslib": "^2.6.2",
9285
"typedoc": "^0.27.6",
9386
"typescript": "^5.2.2"

src/stories/react/MakeCodeBlocksRendering.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Meta, StoryObj } from '@storybook/react';
1+
import { Meta, StoryObj } from '@storybook/react-vite';
22
import { ReactNode, useState } from 'react';
33
import MakeCodeBlocksRendering from '../../react/MakeCodeBlocksRendering.js';
44
import { MakeCodeRenderBlocksProvider } from '../../react/MakeCodeRenderBlocksProvider.js';

src/stories/react/MakeCodeFrame.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Meta, StoryObj } from '@storybook/react';
1+
import { Meta, StoryObj } from '@storybook/react-vite';
22
import { useCallback, useRef } from 'react';
33
import { defaultMakeCodeProject } from '../../vanilla/examples.js';
44
import { MakeCodeFrameDriver } from '../../vanilla/makecode-frame-driver.js';

src/stories/vanilla/makecode-frame-driver.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Meta, StoryObj } from '@storybook/react';
1+
import { Meta, StoryObj } from '@storybook/react-vite';
22
import { useRef } from 'react';
33
import { defaultMakeCodeProject } from '../../vanilla/examples.js';
44
import {

src/stories/vanilla/makecode-render-blocks.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Meta, StoryObj } from '@storybook/react';
1+
import { Meta, StoryObj } from '@storybook/react-vite';
22
import {
33
createMakeCodeRenderBlocks,
44
MakeCodeRenderBlocksOptions,

tsconfig.cjs.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
"moduleResolution": "Node",
66
"esModuleInterop": true,
77
"outDir": "./dist/cjs"
8-
}
8+
},
9+
// Storybook 10 types don't resolve under "moduleResolution": "Node".
10+
// The ESM build still typechecks the stories.
11+
"exclude": ["src/stories"]
912
}

0 commit comments

Comments
 (0)