Skip to content

fix: upgrade storybook to v9 #373

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

Merged
merged 1 commit into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .storybook/addons/button/githubButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button } from '@storybook/components'
import { GithubIcon } from '@storybook/icons'
import { addons, types } from '@storybook/manager-api'
import React from 'react'
import { Button } from 'storybook/internal/components'
import { addons, types } from 'storybook/manager-api'

const ADDON_ID = 'github-link'
const TOOL_ID = `${ADDON_ID}/tool`
Expand Down
2 changes: 1 addition & 1 deletion .storybook/addons/button/logo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addons } from '@storybook/manager-api'
import { addons } from 'storybook/manager-api'

const logoDataAttribute = 'data-storybook-logo-id'
const logoId = 'storybook-sidebar-custom-logo'
Expand Down
4 changes: 2 additions & 2 deletions .storybook/addons/button/viewSourceButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button } from '@storybook/components'
import { addons, type API, types } from '@storybook/manager-api'
import React, { useEffect, useState } from 'react'
import { Button } from 'storybook/internal/components'
import type { API_LeafEntry } from 'storybook/internal/types'
import { addons, type API, types } from 'storybook/manager-api'

const ADDON_ID = 'github-source-link'
const TOOL_ID = `${ADDON_ID}/tool`
Expand Down
7 changes: 1 addition & 6 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
/* eslint-disable storybook/no-uninstalled-addons */
import type { StorybookConfig } from '@storybook/react-webpack5'
import path from 'path'

const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(tsx)', '../docs/*.mdx'],

addons: [
'@storybook/addon-toolbars',
'@storybook/addon-viewport',
'storybook-addon-mock',
{
name: '@storybook/addon-docs',
Expand All @@ -19,9 +17,6 @@ const config: StorybookConfig = {
name: '@storybook/react-webpack5',
options: {},
},
docs: {
autodocs: 'tag',
},
typescript: {
// Overrides the default Typescript configuration to allow multi-package components to be documented via Autodocs.
reactDocgen: 'react-docgen',
Expand Down
2 changes: 1 addition & 1 deletion .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './addons/button/logo.tsx'

import { addons } from '@storybook/manager-api'
import { addons } from 'storybook/manager-api'

import rusticTheme from './rusticTheme'

Expand Down
24 changes: 13 additions & 11 deletions .storybook/preview.js → .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport'
import { CssBaseline, ThemeProvider } from '@mui/material'
import { ThemeProvider } from '@mui/material'
import CssBaseline from '@mui/material/CssBaseline'
import { StyledEngineProvider } from '@mui/material/styles'
import {
Title,
Subtitle,
ArgTypes,
Description,
Primary,
ArgTypes,
Stories,
} from '@storybook/blocks'
import { rusticLightTheme, rusticDarkTheme } from '../src/rusticTheme'

Subtitle,
Title,
} from '@storybook/addon-docs/blocks'
import type { StoryContext, StoryFn } from '@storybook/react-webpack5'
import React from 'react'
import { INITIAL_VIEWPORTS } from 'storybook/viewport'

import { rusticDarkTheme, rusticLightTheme } from '../src/rusticTheme'

export const globalTypes = {
theme: {
Expand All @@ -27,7 +29,7 @@ export const globalTypes = {
},
}

const withMuiTheme = (Story, context) => {
const withMuiTheme = (Story: StoryFn, context: StoryContext) => {
const theme =
context.globals.theme === 'light' ? rusticLightTheme : rusticDarkTheme

Expand Down Expand Up @@ -90,11 +92,11 @@ const preview = {
},
}

export const webpackFinal = async (config) => {
export const webpackFinal = async (config: any) => {
config.module.rules.push({
test: /\.css$/,
use: ['style-loader', 'css-loader'],
include: path.resolve(__dirname, '../'),
include: '../',
})

config.module.rules.push({
Expand Down
2 changes: 1 addition & 1 deletion .storybook/rusticTheme.js → .storybook/rusticTheme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { create } from '@storybook/theming/create'
import { create } from 'storybook/theming'

export default create({
base: 'light',
Expand Down
2 changes: 1 addition & 1 deletion docs/quickStart.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Source, Meta } from '@storybook/addon-docs'
import { Source, Meta } from '@storybook/addon-docs/blocks'

<Meta title="Documentation/Quick Start" />

Expand Down
2 changes: 1 addition & 1 deletion docs/theme.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Source, Meta } from '@storybook/addon-docs'
import { Source, Meta } from '@storybook/addon-docs/blocks'

<Meta title="Documentation/Theme And Styling" />

Expand Down
2 changes: 1 addition & 1 deletion docs/troubleshooting.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Source, Meta } from '@storybook/addon-docs'
import { Source, Meta } from '@storybook/addon-docs/blocks'

<Meta title="Documentation/Troubleshooting" />

Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Source, Meta } from '@storybook/addon-docs'
import { Source, Meta } from '@storybook/addon-docs/blocks'

<Meta title="Documentation/Usage" />

Expand Down
10 changes: 5 additions & 5 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const compat = new FlatCompat({
export default [{
ignores: ['**/jest.config.js', '**/webpack.config.js', '**/webpack.prod.config.js'],
}, ...compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:cypress/recommended',
'plugin:storybook/recommended',
'prettier',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:cypress/recommended',
'plugin:storybook/recommended',
'prettier',
), {
plugins: {
"unused-imports": unusedImports,
Expand Down
Loading