Skip to content

Commit 3598c51

Browse files
chore: upgrade to storybook 10 (#1827)
Upgrades Storybook from 8.6 to 10.3. The only breaking change in v10 is ESM-only, so the main config needed a small conversion from CJS to ESM.
1 parent 9976b8f commit 3598c51

5 files changed

Lines changed: 519 additions & 342 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ yarn-debug.log*
2727
yarn-error.log*
2828
package-lock.json
2929
bundle.stats.json
30+
debug-storybook.log
3031

3132
# DHIS2 Platform
3233
.d2

.storybook/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Direct path required because the package exports field doesn't expose this subpath
2+
import { createRequire } from 'node:module'
3+
const require = createRequire(import.meta.url)
24
const makeBabelConfig = require('../node_modules/@dhis2/cli-app-scripts/config/makeBabelConfig.js')
35

4-
module.exports = {
6+
export default {
57
addons: ['@storybook/preset-create-react-app'],
68
stories: ['../src/__demo__/**/*.stories.@(js)'],
79

.storybook/preview.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { CssReset } from '@dhis2/ui'
22
import React from 'react'
3-
const { withJsx } = require('@mihkeleidast/storybook-addon-source')
43

54
export const decorators = [
6-
withJsx,
75
(Story) => (
86
<div>
97
<CssReset />

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@
3535
"@dhis2/cli-style": "^10.7.9",
3636
"@dhis2/d2-i18n": "^1.1.0",
3737
"@dhis2/ui": "^10.12.7",
38-
"@mihkeleidast/storybook-addon-source": "^1.0.1",
39-
"@storybook/preset-create-react-app": "^8.3.6",
40-
"@storybook/react": "^8.3.6",
41-
"@storybook/react-webpack5": "^8.3.6",
38+
"@storybook/preset-create-react-app": "^10.3.4",
39+
"@storybook/react-webpack5": "^10.3.4",
4240
"@testing-library/dom": "^10.4.0",
4341
"@testing-library/jest-dom": "^6.6.3",
4442
"@testing-library/react": "^16.3.0",
@@ -48,8 +46,9 @@
4846
"react": "^18.3.1",
4947
"react-dom": "^18.3.1",
5048
"react-scripts": "^5.0.1",
51-
"storybook": "^8.3.6",
52-
"styled-jsx": "^4.0.1"
49+
"storybook": "^10.3.4",
50+
"styled-jsx": "^4.0.1",
51+
"eslint-plugin-storybook": "10.3.4"
5352
},
5453
"peerDependencies": {
5554
"@dhis2/app-runtime": "^3",

0 commit comments

Comments
 (0)