-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: Storybook & 테스트 세팅 #22
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
03a35d7
⚙️ Chore: gitignore 스토리북 관련 파일 추가
aahreum d766ff0
⚙️ Chore: workspace에 apps 추가
aahreum 40d9e4c
⚙️ Chore: turbo dev 명령어 추가
aahreum 3c66a95
⚙️ Chore: ls-lint 스토리북 폴더 추가
aahreum 5a0f414
⚙️ Chore: 스토리북 린트 에러 추가
aahreum 6309469
⚙️ Chore: 스토리북 의존성 설치 및 ts 설정 파일 추가
aahreum 0fc4845
⚙️ Chore: 스토리북 설정 파일 및 intro 문서 추가
aahreum 0b44e9b
⚙️ Chore: clean 명령어 추가
aahreum f067eca
⚙️ Chore: ls-lint ignore에 스토리북 빌드 파일 추가
aahreum 0cf6f0d
⚙️ Chore: dev에 build 실행 추가
aahreum 17d1fb3
⚙️ Chore: a11y 옵션 todo로 변경
aahreum 4bab943
⚙️ Chore: 크로마틱 설정 파일 추가
aahreum fac59e9
⚙️ Chore: 스토리북 테스트 플러그인 추가
aahreum e3a711d
⚙️ Chore: 테스트 스크립트 추가
aahreum eacf217
📝 Docs: 리드미 수정
aahreum c57bd6c
⚙️ Chore: 패키지 이름 통일 및 스크립트 수정
aahreum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,3 +31,8 @@ coverage | |
|
|
||
| # TypeScript | ||
| *.tsbuildinfo | ||
|
|
||
| # storybook | ||
| *.log | ||
| *storybook.log | ||
| storybook-static | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,3 +26,7 @@ ignore: | |
| - .git | ||
| - .vscode | ||
| - .husky | ||
| - .storybook | ||
| - '**/.storybook' | ||
| - storybook-static | ||
| - '**/storybook-static' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { dirname } from 'path'; | ||
| import { fileURLToPath } from 'url'; | ||
| import type { StorybookConfig } from '@storybook/react-vite'; | ||
|
|
||
| /** | ||
| * This function is used to resolve the absolute path of a package. | ||
| * It is needed in projects that use Yarn PnP or are set up within a monorepo. | ||
| */ | ||
| function getAbsolutePath(value: string) { | ||
| return dirname(fileURLToPath(import.meta.resolve(`${value}/package.json`))); | ||
| } | ||
| const config: StorybookConfig = { | ||
| stories: [ | ||
| '../docs/*.mdx', | ||
| '../../../packages/**/src/**/*.stories.@(ts|tsx|mdx)', | ||
| '../../../packages/**/src/**/*.mdx', | ||
| ], | ||
| addons: [ | ||
| getAbsolutePath('@chromatic-com/storybook'), | ||
| getAbsolutePath('@storybook/addon-a11y'), | ||
| getAbsolutePath('@storybook/addon-docs'), | ||
| getAbsolutePath('@storybook/addon-vitest'), | ||
| ], | ||
| framework: getAbsolutePath('@storybook/react-vite'), | ||
| }; | ||
| export default config; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import type { Preview } from '@storybook/react-vite'; | ||
|
|
||
| const preview: Preview = { | ||
| parameters: { | ||
| controls: { | ||
| matchers: { | ||
| color: /(background|color)$/i, | ||
| date: /Date$/i, | ||
| }, | ||
| }, | ||
| layout: 'centered', | ||
| actions: { argTypesRegex: '^on.*' }, | ||
| a11y: { | ||
| test: 'todo', | ||
| }, | ||
| }, | ||
| tags: ['autodocs'], | ||
| }; | ||
|
|
||
| export default preview; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import * as a11yAddonAnnotations from '@storybook/addon-a11y/preview'; | ||
| import { setProjectAnnotations } from '@storybook/react-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 | ||
| setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "onlyChanged": true, | ||
| "exitOnceUploaded": false, | ||
| "projectId": "Project:69a1914cee031a546b3446cd", | ||
| "storybookBaseDir": "apps/storybook", | ||
| "zip": true, | ||
| "buildScriptName": "build" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { Meta } from '@storybook/addon-docs/blocks'; | ||
|
|
||
| <Meta title='Introduction' /> | ||
|
|
||
| # Mumukji Design System | ||
|
|
||
| 머먹지 디자인 시스템! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "name": "@mumukji/storybook", | ||
| "private": true, | ||
| "type": "module", | ||
| "description": "Storybook for the Mumukji design system.", | ||
| "scripts": { | ||
| "dev": "storybook dev -p 6006", | ||
| "build": "storybook build", | ||
| "typecheck": "tsc --noEmit", | ||
| "chromatic": "chromatic --project-token=$CHROMATIC_PROJECT_TOKEN", | ||
| "clean": "rm -rf storybook-static", | ||
| "test": "vitest run" | ||
| }, | ||
| "dependencies": { | ||
| "@mumukji/icons": "workspace:*", | ||
| "@mumukji/tokens": "workspace:*", | ||
| "@mumukji/ui": "workspace:*", | ||
| "react": "^19.2.4", | ||
| "react-dom": "^19.2.4" | ||
| }, | ||
| "devDependencies": { | ||
| "@chromatic-com/storybook": "^5.0.1", | ||
| "@storybook/addon-a11y": "^10.2.13", | ||
| "@storybook/addon-docs": "^10.2.13", | ||
| "@storybook/addon-vitest": "^10.2.13", | ||
| "@storybook/react-vite": "^10.2.13", | ||
| "@types/react": "^19.2.7", | ||
| "@types/react-dom": "^19.2.3", | ||
| "@vitejs/plugin-react": "^5.1.4", | ||
| "@vitest/browser-playwright": "^4.0.18", | ||
| "playwright": "^1.58.2", | ||
| "storybook": "^10.2.13", | ||
| "vite": "^7.3.1", | ||
| "vitest": "^4.0.18" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "extends": "../../tsconfig.base.json", | ||
| "compilerOptions": { | ||
| "lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
| "jsx": "react-jsx" | ||
| }, | ||
| "include": [".storybook/*.ts"] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /// <reference types="vitest/config" /> | ||
|
|
||
| // https://vite.dev/config/ | ||
| import path from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { storybookTest } from '@storybook/addon-vitest/vitest-plugin'; | ||
| import react from '@vitejs/plugin-react'; | ||
| import { playwright } from '@vitest/browser-playwright'; | ||
| import { defineConfig } from 'vite'; | ||
|
|
||
| const dirname = | ||
| typeof __dirname !== 'undefined' | ||
| ? __dirname | ||
| : path.dirname(fileURLToPath(import.meta.url)); | ||
|
|
||
| // More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon | ||
| export default defineConfig({ | ||
| plugins: [react()], | ||
| test: { | ||
| projects: [ | ||
| { | ||
| extends: true, | ||
| plugins: [ | ||
| // The plugin will run tests for the stories defined in your Storybook config | ||
| // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest | ||
| storybookTest({ | ||
| configDir: path.join(dirname, '.storybook'), | ||
| }), | ||
| ], | ||
| test: { | ||
| name: 'storybook', | ||
| browser: { | ||
| enabled: true, | ||
| headless: true, | ||
| provider: playwright({}), | ||
| instances: [ | ||
| { | ||
| browser: 'chromium', | ||
| }, | ||
| ], | ||
| }, | ||
| setupFiles: ['.storybook/vitest.setup.ts'], | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.