Skip to content

Commit 3eeb610

Browse files
authored
Merge pull request #9 from Nexters/feat/storybook-driverjs
[설정/온보딩] 스토리북 세팅 및 driverjs 예제작업
2 parents 89d9dc7 + 6d8528c commit 3eeb610

File tree

14 files changed

+1541
-6
lines changed

14 files changed

+1541
-6
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ dist-ssr
2323

2424
# TanStack Router generated files
2525
.tanstack
26+
27+
*storybook.log
28+
storybook-static

.storybook/main.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { StorybookConfig } from '@storybook/react-vite';
2+
3+
const config: StorybookConfig = {
4+
"stories": [
5+
"../src/**/*.mdx",
6+
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
7+
],
8+
"addons": [
9+
"@chromatic-com/storybook",
10+
"@storybook/addon-docs",
11+
"@storybook/addon-a11y",
12+
"@storybook/addon-vitest"
13+
],
14+
"framework": {
15+
"name": "@storybook/react-vite",
16+
"options": {}
17+
}
18+
};
19+
export default config;

.storybook/preview.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import type { Decorator, Preview } from "@storybook/react-vite";
2+
import "../src/index.css";
3+
import {
4+
createRootRoute,
5+
createRouter,
6+
RouterProvider,
7+
} from "@tanstack/react-router";
8+
9+
const RouterDecorator: Decorator = (Story) => {
10+
const rootRoute = createRootRoute({ component: () => <Story /> });
11+
const routeTree = rootRoute;
12+
const router = createRouter({ routeTree });
13+
return <RouterProvider router={router} />;
14+
};
15+
16+
const preview: Preview = {
17+
parameters: {
18+
controls: {
19+
matchers: {
20+
color: /(background|color)$/i,
21+
date: /Date$/i,
22+
},
23+
},
24+
25+
a11y: {
26+
// 'todo' - show a11y violations in the test UI only
27+
// 'error' - fail CI on a11y violations
28+
// 'off' - skip a11y checks entirely
29+
test: "todo",
30+
},
31+
},
32+
initialGlobals: {
33+
viewport: { value: "iphone6" },
34+
},
35+
decorators: [RouterDecorator],
36+
};
37+
38+
export default preview;

.storybook/vitest.setup.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview";
2+
import { setProjectAnnotations } from '@storybook/react-vite';
3+
import * as projectAnnotations from './preview';
4+
5+
// This is an important step to apply the right configuration when testing your stories.
6+
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
7+
setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]);

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["bradlc.vscode-tailwindcss", "biomejs.biome"]
3+
}

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"editor.defaultFormatter": "biomejs.biome",
33
"editor.codeActionsOnSave": {
4-
"source.fixAll": "explicit",
5-
"source.organizeImports": "explicit"
4+
"source.fixAll.biome": "explicit",
5+
"source.organizeImports.biome": "explicit"
66
}
77
}

biome.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
"semicolons": "always"
2121
}
2222
},
23+
"assist": {
24+
"actions": {
25+
"source": {
26+
"organizeImports": "on"
27+
}
28+
}
29+
},
2330
"vcs": {
2431
"enabled": true,
2532
"clientKind": "git",

package.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,29 @@
1111
"format": "biome format --write .",
1212
"lint": "biome lint .",
1313
"check": "biome check --apply .",
14-
"generate": "orval --config orval.config.ts"
14+
"generate": "orval --config orval.config.ts",
15+
"storybook": "storybook dev -p 6006",
16+
"build-storybook": "storybook build"
1517
},
1618
"dependencies": {
1719
"@hotjar/browser": "1.0.9",
1820
"@radix-ui/react-dialog": "1.1.14",
1921
"@radix-ui/themes": "3.2.1",
2022
"@tanstack/react-router": "1.127.8",
2123
"axios": "1.11.0",
24+
"driver.js": "^1.3.6",
2225
"embla-carousel-react": "8.6.0",
2326
"js-cookie": "3.0.5",
2427
"react": "19.1.0",
2528
"react-dom": "19.1.0"
2629
},
2730
"devDependencies": {
2831
"@biomejs/biome": "2.1.1",
32+
"@chromatic-com/storybook": "^4.0.1",
33+
"@storybook/addon-a11y": "^9.0.18",
34+
"@storybook/addon-docs": "^9.0.18",
35+
"@storybook/addon-vitest": "^9.0.18",
36+
"@storybook/react-vite": "^9.0.18",
2937
"@tanstack/react-router-devtools": "1.127.8",
3038
"@tanstack/router-vite-plugin": "1.127.8",
3139
"@types/js-cookie": "3.0.6",
@@ -35,9 +43,14 @@
3543
"msw": "2.10.4",
3644
"orval": "7.10.0",
3745
"postcss": "8",
46+
"storybook": "^9.0.18",
3847
"tailwindcss": "3.4.17",
3948
"typescript": "5.8.3",
40-
"vite": "7.0.4"
49+
"vite": "7.0.4",
50+
"vitest": "^3.2.4",
51+
"@vitest/browser": "^3.2.4",
52+
"playwright": "^1.54.1",
53+
"@vitest/coverage-v8": "^3.2.4"
4154
},
4255
"msw": {
4356
"workerDirectory": [

0 commit comments

Comments
 (0)