Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
60a3c33
fix: Storybook 메이저 버전 업데이트
yeonhwan Jun 25, 2025
6d83821
fix: Badge.stories 수정 및 Badge 컴포넌트 리팩토링
yeonhwan Jun 25, 2025
bd1e17f
fix: Button.stories 수정 및 Button 컴포넌트 리팩토링
yeonhwan Jun 25, 2025
6715057
fix: Chip.stories 수정
yeonhwan Jun 25, 2025
36b5d12
fix: Chip-input.stories 수정
yeonhwan Jun 25, 2025
60e4735
fix: Dropdown.stories 수정
yeonhwan Jun 25, 2025
04c96f9
fix: Input.stories 수정
yeonhwan Jun 25, 2025
ef0932a
fix: Table.stories 수정 및 Tablelist 관련 컴포넌트 수정
yeonhwan Jun 25, 2025
304c2c5
fix: Toggle.stories 수정
yeonhwan Jun 25, 2025
d00cdb5
fix: Calendar.stories 수정 및 msw 추가
yeonhwan Jun 25, 2025
dd64608
feat: widget/banner.stories 추가 vite-plugin-svgr 추가
yeonhwan Jun 25, 2025
40e6071
fix: MSW, Vitest 관련 Storybook 환경설정 정리
yeonhwan Jul 10, 2025
7278441
fix: cookie 함수 관련 서버환경 체킹 과정 수정
yeonhwan Jul 10, 2025
cc0b346
fix: ui/table 리팩토링과정중 충돌부분 원상태로 복구
yeonhwan Jul 10, 2025
c4a7e00
feat: widget/banner.stories 수정 및 추가작업
yeonhwan Jul 10, 2025
19d2cf8
feat: widget/home/header.stories 추가
yeonhwan Jul 10, 2025
780c510
feat: widget/home/sidebar.stories 추가 및 원 컴포넌트 리팩토링
yeonhwan Jul 10, 2025
18a9241
feat: widget/home/study-list-table.stories 추가 및 기존 study-list-table 충…
yeonhwan Jul 10, 2025
345d627
feat: widget/home/todo-list.stories 추가
yeonhwan Jul 10, 2025
f2e81f9
feat: widget/my-page/profileinfo-card.stories 추가
yeonhwan Jul 10, 2025
a8e9673
feat: widget/my-page/sidebar.stories 추가
yeonhwan Jul 10, 2025
f251062
feat: widget/my-study-card.stories 추가
yeonhwan Jul 10, 2025
f0dc429
chore: 기존의 banner.storeis 위치 변경 및 삭제
yeonhwan Jul 10, 2025
9c16f61
chore: 필요없는 주석 및 console.log 제거
yeonhwan Jul 18, 2025
0a1aec6
chore: 필요없는 mockServiceWorker 중복파일 제거
yeonhwan Jul 18, 2025
cd97aea
fix: shared/table-list 관련 수정 및 디폴트 분기 적용
yeonhwan Jul 18, 2025
34985fa
chore: calendar.stories 필요 없는 주석 대체
yeonhwan Jul 18, 2025
ebfaaaf
refactor: modal.stories meta 정보 추가 및 리팩토링
yeonhwan Jul 18, 2025
9b81b6c
chore: toggle.stories 주석 추가
yeonhwan Jul 18, 2025
fffb39d
fix: widgets/home/header.stories 제거
yeonhwan Jul 18, 2025
635dfa9
fix: sidebar.tsx studyApplied 옵셔널체이닝 추가 및 story 파일에 변수 추가
yeonhwan Jul 18, 2025
975065a
fix: storybook msw addon에 정적에셋 경로 제외로 경고 억제
yeonhwan Jul 18, 2025
93c9271
fix: storybook 의 워닝 및 에러 로그 제거 및 msw 연결
yeonhwan Jul 18, 2025
3cce062
fix: rebase 충돌 해결 및 디폴트 값 관련 오류 처리
yeonhwan Jul 19, 2025
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
56 changes: 41 additions & 15 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,53 @@
import type { StorybookConfig } from '@storybook/experimental-nextjs-vite';
import { mergeConfig } from 'vite';
import path from 'path';
import type { StorybookConfig } from '@storybook/nextjs-vite';
import svgr from 'vite-plugin-svgr';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
stories: [
'../stories/**/*.mdx',
'../src/stories/**/*.stories.@(js|jsx|mjs|ts|tsx)',
],
addons: [
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/experimental-addon-test',
'@storybook/addon-docs',
'msw-storybook-addon',
'@storybook/addon-vitest'
],
framework: {
name: '@storybook/experimental-nextjs-vite',
name: '@storybook/nextjs-vite',
options: {},
},
staticDirs: ['../public'],
async viteFinal(config) {
return mergeConfig(config, {
resolve: {
alias: {
'@': path.resolve(__dirname, '../src'),
},
},
staticDirs: ['../public', '../public/mock/'],
viteFinal: (config) => {
// SVGR plugin이 Storybook 내 Vite 번들링에 사용되도록 추가
config.plugins = [...(config.plugins || []), svgr({ include: /\.svg$/ })];

// nextjs-vite 내에서 SVGR 이 작동하도록 plugin 동작 수정
// 출처: https://github.com/ygkn/storybook-nextjs-vite-svgr/blob/main/.storybook/main.ts
config.plugins = config.plugins!.flat().map((plugin) => {
if (
typeof plugin === 'object' &&
plugin !== null &&
'name' in plugin &&
plugin.name === 'vite-plugin-storybook-nextjs-image'
) {
return {
...plugin,
resolveId(id, importer) {
if (id.endsWith('.svg')) {
return null;
}

// @ts-expect-error `resolveId` hook of vite-plugin-storybook-nextjs-image is a function
return plugin.resolveId(id, importer);
},
};
}
return plugin;
});

config.plugins = [...config.plugins];

return config;
},
};
export default config;
42 changes: 33 additions & 9 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
import { initialize, mswLoader } from 'msw-storybook-addon';
import '../app/global.css';
import type { Preview } from '@storybook/nextjs-vite';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

import React from 'react';
import '../app/global.css';
// initialize MSW
initialize({
onUnhandledRequest: (req, print) => {
// supress warnings for requesting static assets
const isStaticAssetRequest =
/(public|assets)\/(.*?)\.|(svg|jpg|jpeg|png|webp)(\?.*)?$/g;

import QueryProvider from '../src/app/provider/query-provider';
if (isStaticAssetRequest.test(req.url)) {
return;
}
print.warning();
},
Comment on lines +8 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

msw 환경이 정적 에셋 요청을 워닝으로 남기는 로깅에 대하여 관련 URL 화이트리스트 처리

이 부분이랑 연관된 내용으로 보입니다!
어떤 이유로 warning 로깅이 되었는지, url 화이트리스트로 했으면 로깅이 안남는건지 궁금합니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저 부분은 제가 추가한 코드입니다!
디폴트 동작을 완전히 제거할 경우 혹시 모를 상황이 생길까봐 남겨둔 뒤 정규표현식으로 파악되는 에셋 요청들만 제거했습니다.

});

import type { Preview } from '@storybook/react';
// test query client for not caching results
const testQueryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 0,
retry: false,
},
},
});

const preview: Preview = {
// mocking APIs of server interaction
parameters: {
controls: {
matchers: {
Expand All @@ -19,12 +40,15 @@ const preview: Preview = {
appDirectory: true,
},
},
loaders: [mswLoader],
decorators: [
(Story) => (
<QueryProvider>
<Story />
</QueryProvider>
),
(Story) => {
return (
<QueryClientProvider client={testQueryClient}>
<Story />
</QueryClientProvider>
);
},
],
};

Expand Down
8 changes: 5 additions & 3 deletions .storybook/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { beforeAll } from 'vitest';
import { setProjectAnnotations } from '@storybook/experimental-nextjs-vite';
import { setProjectAnnotations } from '@storybook/nextjs-vite';
import * as projectAnnotations from './preview';

// This is an important step to apply the right configuration when testing your stories.
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
const project = setProjectAnnotations([projectAnnotations]);
const annotaions = setProjectAnnotations([projectAnnotations]);

// Run Storybook's beforeAll hook
beforeAll(annotaions.beforeAll);

beforeAll(project.beforeAll);
24 changes: 14 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,11 @@
"zustand": "^5.0.3"
},
"devDependencies": {
"@chromatic-com/storybook": "^3.2.6",
"@chromatic-com/storybook": "^4.0.1",
"@rushstack/eslint-config": "^4.1.1",
"@storybook/addon-essentials": "^8.6.12",
"@storybook/addon-onboarding": "^8.6.12",
"@storybook/blocks": "^8.6.12",
"@storybook/experimental-addon-test": "^8.6.12",
"@storybook/experimental-nextjs-vite": "^8.6.12",
"@storybook/react": "^8.6.12",
"@storybook/test": "^8.6.12",
"@storybook/addon-docs": "^9.0.12",
"@storybook/addon-vitest": "^9.0.12",
"@storybook/nextjs-vite": "^9.0.12",
"@svgr/webpack": "^8.1.0",
"@tanstack/eslint-plugin-query": "^5.66.1",
"@tanstack/react-query": "^5.66.0",
Expand All @@ -64,7 +60,7 @@
"@typescript-eslint/parser": "^8.24.0",
"@vitest/browser": "^3.1.1",
"@vitest/coverage-v8": "^3.1.1",
"chromatic": "^11.28.0",
"chromatic": "^13.0.1",
"eslint": "^8.57.0",
"eslint-config-next": "^15.1.7",
"eslint-config-prettier": "^10.0.1",
Expand All @@ -73,13 +69,21 @@
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.19",
"eslint-plugin-storybook": "^0.12.0",
"msw": "^2.10.2",
"msw-storybook-addon": "^2.0.5",
"playwright": "^1.51.1",
"prettier": "^3.5.1",
"prettier-plugin-tailwindcss": "^0.6.11",
"shadcn": "^2.4.0-canary.6",
"storybook": "^8.6.12",
"storybook": "^9.0.12",
"typescript": "^5",
"typescript-eslint": "^8.24.0",
"vite-plugin-svgr": "^4.3.0",
"vitest": "^3.1.1"
},
"msw": {
"workerDirectory": [
"public"
]
}
}
Loading