Skip to content
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

chore: bump up storybook monorepo to v8 (major) #6068

Merged
merged 3 commits into from
Aug 16, 2024
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
67 changes: 50 additions & 17 deletions packages/frontend/component/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,58 @@
import { dirname, join } from 'path';
import { StorybookConfig } from '@storybook/react-vite';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import swc from 'unplugin-swc';
import { mergeConfig } from 'vite';
import { getRuntimeConfig } from '@affine/cli/src/webpack/runtime-config';

export default {
stories: ['../src/ui/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
stories: ['../src/ui/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'],

addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-mdx-gfm',
'storybook-dark-mode',
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@storybook/addon-interactions'),
getAbsolutePath('@storybook/addon-mdx-gfm'),
getAbsolutePath('storybook-dark-mode'),
'@chromatic-com/storybook',
],

framework: {
name: '@storybook/react-vite',
name: getAbsolutePath('@storybook/react-vite'),
options: {},
},
features: {
storyStoreV7: true,
},
docs: {
autodocs: true,
},

features: {},

docs: {},

async viteFinal(config, _options) {
return mergeConfig(config, {
plugins: [vanillaExtractPlugin()],
esbuild: {
target: 'ES2022',
},
plugins: [
vanillaExtractPlugin(),
swc.vite({
jsc: {
preserveAllComments: true,
parser: {
syntax: 'typescript',
dynamicImport: true,
tsx: true,
decorators: true,
},
target: 'es2022',
externalHelpers: false,
transform: {
react: {
runtime: 'automatic',
},
useDefineForClassFields: false,
decoratorVersion: '2022-03',
},
},
sourceMaps: true,
inlineSourcesContent: true,
}),
],
define: {
'process.env.CAPTCHA_SITE_KEY': `"${process.env.CAPTCHA_SITE_KEY}"`,
runtimeConfig: getRuntimeConfig({
Expand All @@ -39,4 +64,12 @@ export default {
},
});
},

typescript: {
reactDocgen: 'react-docgen-typescript',
},
} satisfies StorybookConfig;

function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, 'package.json')));
}
1 change: 1 addition & 0 deletions packages/frontend/component/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ export const decorators = [
);
},
];
export const tags = ['autodocs'];
26 changes: 13 additions & 13 deletions packages/frontend/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,29 @@
"@blocksuite/icons": "2.1.62",
"@blocksuite/presets": "0.17.0-canary-202408160752-cb4b196",
"@blocksuite/store": "0.17.0-canary-202408160752-cb4b196",
"@storybook/addon-actions": "^7.6.17",
"@storybook/addon-essentials": "^7.6.17",
"@storybook/addon-interactions": "^7.6.17",
"@storybook/addon-links": "^7.6.17",
"@storybook/addon-mdx-gfm": "^7.6.17",
"@storybook/addon-storysource": "^7.6.17",
"@storybook/blocks": "^7.6.17",
"@storybook/builder-vite": "^7.6.17",
"@storybook/jest": "^0.2.3",
"@storybook/react": "^7.6.17",
"@storybook/react-vite": "^7.6.17",
"@chromatic-com/storybook": "^1",
"@storybook/addon-actions": "^8.2.9",
"@storybook/addon-essentials": "^8.2.9",
"@storybook/addon-interactions": "^8.2.9",
"@storybook/addon-links": "^8.2.9",
"@storybook/addon-mdx-gfm": "^8.2.9",
"@storybook/addon-storysource": "^8.2.9",
"@storybook/blocks": "^8.2.9",
"@storybook/react": "^8.2.9",
"@storybook/react-vite": "^8.2.9",
"@storybook/test": "^8.2.9",
"@storybook/test-runner": "^0.19.0",
"@storybook/testing-library": "^0.2.2",
"@testing-library/react": "^16.0.0",
"@types/bytes": "^3.1.4",
"@types/react": "^18.2.75",
"@types/react-dnd": "^3.0.2",
"@types/react-dom": "^18.2.24",
"@vanilla-extract/css": "^1.14.2",
"fake-indexeddb": "^6.0.0",
"storybook": "^7.6.17",
"storybook": "^8.2.9",
"storybook-dark-mode": "4.0.1",
"typescript": "^5.4.5",
"unplugin-swc": "^1.5.1",
"vite": "^5.2.8",
"vitest": "1.6.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"fake-indexeddb": "^6.0.0",
"lodash-es": "^4.17.21",
"mime-types": "^2.1.35",
"react-refresh": "^0.10.0",
"vitest": "1.6.0"
}
}
1 change: 1 addition & 0 deletions tools/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@perfsee/webpack": "^1.12.2",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
"@sentry/webpack-plugin": "^2.16.1",
"@types/mime-types": "^2.1.4",
"@types/webpack-env": "^1.18.4",
"@vanilla-extract/webpack-plugin": "^2.3.7",
"autoprefixer": "^10.4.19",
Expand Down
Loading
Loading