Skip to content

chore(site): Upgrade storybook to 7.0.4 #7127

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 7 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Upgrade storybook
  • Loading branch information
BrunoQuaresma committed Apr 12, 2023
commit 7aa731f43aa7042bb89637c495eeee130e212fd8
42 changes: 7 additions & 35 deletions site/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
/**
* @fileoverview This file is configures Storybook
*
* @see <https://storybook.js.org/docs/react/configure/overview>
*/
const path = require("path")

module.exports = {
// Automatically loads all stories in source ending in 'stories.tsx'
//
// SEE: https://storybook.js.org/docs/react/configure/overview#configure-story-loading
stories: ["../src/**/*.stories.tsx"],

// addons are official and community plugins to extend Storybook.
//
// SEE: https://storybook.js.org/addons
addons: [
"@storybook/addon-links",
{
Expand All @@ -22,28 +8,14 @@ module.exports = {
actions: false,
},
},
"@storybook/addon-mdx-gfm",
],

// SEE: https://storybook.js.org/docs/react/configure/babel
babel: async (options) => ({
...options,
plugins: [["@babel/plugin-proposal-class-properties", { loose: true }]],
}),

// Static files loaded by storybook, relative to this file.
//
// SEE: https://storybook.js.org/docs/react/configure/overview#using-storybook-api
staticDirs: ["../static"],

// Storybook internally uses its own Webpack configuration instead of ours.
//
// SEE: https://storybook.js.org/docs/react/configure/webpack
webpackFinal: async (config) => {
config.resolve.modules = [
path.resolve(__dirname, ".."),
"node_modules",
"../src",
]
return config
framework: {
name: "@storybook/react-vite",
options: {},
},
docs: {
autodocs: true,
},
}
30 changes: 14 additions & 16 deletions site/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
import CssBaseline from "@material-ui/core/CssBaseline"
import ThemeProvider from "@material-ui/styles/ThemeProvider"
import { createMemoryHistory } from "history"
import { addDecorator } from "node_modules/@storybook/react"
import { unstable_HistoryRouter as HistoryRouter } from "react-router-dom"
import { dark } from "../src/theme"
import "../src/theme/globalFonts"
import "../src/i18n"

addDecorator((story) => (
<ThemeProvider theme={dark}>
<CssBaseline />
{story()}
</ThemeProvider>
))

const history = createMemoryHistory()

const routerDecorator = (Story) => {
return (
<HistoryRouter history={history}>
export const decorators = [
(Story) => (
<ThemeProvider theme={dark}>
<CssBaseline />
<Story />
</HistoryRouter>
)
}

addDecorator(routerDecorator)
</ThemeProvider>
),
(Story) => {
return (
<HistoryRouter history={history}>
<Story />
</HistoryRouter>
)
},
]

export const parameters = {
actions: {
Expand Down
18 changes: 11 additions & 7 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"lint:fix": "FIX=true yarn lint",
"playwright:install": "playwright install --with-deps chromium",
"playwright:test": "playwright test --config=e2e/playwright.config.ts",
"storybook": "start-storybook -p 6006",
"storybook:build": "build-storybook",
"storybook": "storybook dev -p 6006",
"storybook:build": "storybook build",
"test": "jest --selectProjects test",
"test:ci": "jest --selectProjects test --silent",
"test:coverage": "jest --selectProjects test --collectCoverage",
Expand Down Expand Up @@ -93,10 +93,12 @@
},
"devDependencies": {
"@playwright/test": "1.29.2",
"@storybook/addon-actions": "6.5.9",
"@storybook/addon-essentials": "6.5.12",
"@storybook/addon-links": "6.5.9",
"@storybook/react": "6.5.12",
"@storybook/addon-actions": "7.0.4",
"@storybook/addon-essentials": "7.0.4",
"@storybook/addon-links": "7.0.4",
"@storybook/addon-mdx-gfm": "7.0.4",
"@storybook/react": "7.0.4",
"@storybook/react-vite": "7.0.4",
"@swc/core": "1.3.38",
"@swc/jest": "0.2.24",
"@testing-library/jest-dom": "5.16.5",
Expand Down Expand Up @@ -127,6 +129,7 @@
"eslint-plugin-jsx-a11y": "6.6.1",
"eslint-plugin-react": "7.31.1",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-storybook": "^0.6.11",
"eslint-plugin-unicorn": "44.0.0",
"jest": "29.5.0",
"jest-canvas-mock": "2.4.0",
Expand All @@ -139,7 +142,8 @@
"prettier": "2.8.1",
"resize-observer": "1.0.4",
"semver": "7.3.7",
"storybook-addon-mock": "^3.2.0",
"storybook": "7.0.4",
"storybook-addon-mock": "^4.0.0",
"storybook-react-context": "^0.6.0",
"typescript": "4.8.2"
},
Expand Down
Empty file.
Loading