Skip to content

Commit 193bebe

Browse files
author
taku10101
committed
fix:storybook
1 parent 90008cc commit 193bebe

File tree

5 files changed

+42
-48
lines changed

5 files changed

+42
-48
lines changed

.storybook/main.js

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,18 @@
1-
const excludedProps = new Set([
2-
'id',
3-
'slot',
4-
'onCopy',
5-
'onCut',
6-
'onPaste',
7-
'onCompositionStart',
8-
'onCompositionEnd',
9-
'onCompositionUpdate',
10-
'onSelect',
11-
'onBeforeInput',
12-
'onInput'
13-
]);
1+
import graphql from 'vite-plugin-graphql-loader';
142

15-
/** @type { import('@storybook/react-vite').StorybookConfig } */
16-
const config = {
17-
stories: [
18-
"../stories/**/*.mdx",
19-
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)",
20-
],
3+
export default {
4+
// Replace your-framework with the framework you are using (e.g., react-vite, vue3-vite)
5+
framework: '@storybook/react-vite',
6+
stories: ['../src/**/*.mdx', '../*/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
217
addons: [
22-
"@storybook/addon-links",
23-
"@storybook/addon-essentials",
24-
"@storybook/addon-onboarding",
25-
"@storybook/addon-interactions",
8+
'@storybook/addon-essentials',
9+
'@storybook/addon-links',
10+
'@storybook/addon-essentials',
2611
],
27-
framework: {
28-
name: "@storybook/react-vite",
29-
options: {},
30-
},
31-
docs: {
32-
autodocs: "tag",
12+
async viteFinal(config) {
13+
return {
14+
...config,
15+
plugins: [...(config.plugins ?? []), graphql()],
16+
};
3317
},
34-
typescript: {
35-
reactDocgen: 'react-docgen-typescript',
36-
reactDocgenTypescriptOptions: {
37-
shouldExtractLiteralValuesFromEnum: true,
38-
compilerOptions: {
39-
allowSyntheticDefaultImports: false,
40-
esModuleInterop: false,
41-
},
42-
propFilter: (prop) => !prop.name.startsWith('aria-') && !excludedProps.has(prop.name),
43-
},
44-
}
45-
};
46-
export default config;
18+
};

.storybook/preview.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { themes } from "@storybook/theming";
2-
import '../src/index.css';
31

42
/** @type { import('@storybook/react').Preview } */
53
const preview = {
@@ -8,9 +6,7 @@ const preview = {
86
controls: {
97
matchers: {},
108
},
11-
docs: {
12-
theme: window.matchMedia('(prefers-color-scheme: dark)').matches ? themes.dark : themes.light
13-
}
9+
1410
},
1511
};
1612

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"react-router-dom": "^7.5.0",
5151
"tailwind-merge": "^3.1.0",
5252
"tailwind-variants": "^0.3.1",
53+
"vite-plugin-graphql-loader": "^4.0.4",
5354
"zod": "^3.24.2"
5455
},
5556
"sideEffects": false,

pnpm-lock.yaml

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

vitest.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import path from 'node:path';
22
import { fileURLToPath } from 'node:url';
33
import { defineConfig } from 'vitest/config';
4+
import graphqlLoader from 'vite-plugin-graphql-loader';
45

56
const dirname =
6-
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
7+
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
78

89
export default defineConfig({
910
resolve: {
1011
alias: {
1112
'@': path.resolve(dirname, 'src'),
1213
},
1314
},
15+
plugins: [graphqlLoader()],
1416
});

0 commit comments

Comments
 (0)