Skip to content
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
28 changes: 28 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { StorybookConfig } from '@storybook/react-vite';

import { join, dirname } from "path"

/**
* 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): any {
return dirname(require.resolve(join(value, 'package.json')))
}
const config: StorybookConfig = {
"stories": [
"../stories/**/*.mdx",
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"
],
Comment on lines +13 to +16
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

스토리 탐색 글롭이 패키지 내 컴포넌트 스토리를 누락합니다 (Level.stories.tsx가 로드되지 않음).

현재 설정은 ../stories/**만 대상으로 하므로 packages/design-system/src/**/Level.stories.tsx가 스토리북에 나타나지 않습니다. 모노레포 전역에서 스토리를 탐색하도록 글롭을 확장해 주세요.

다음 패치를 제안합니다:

   "stories": [
     "../stories/**/*.mdx",
-    "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"
+    "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)",
+    "../packages/**/*.mdx",
+    "../packages/**/*.stories.@(js|jsx|mjs|ts|tsx)"
   ],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"stories": [
"../stories/**/*.mdx",
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"
],
"stories": [
"../stories/**/*.mdx",
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)",
"../packages/**/*.mdx",
"../packages/**/*.stories.@(js|jsx|mjs|ts|tsx)"
],
🤖 Prompt for AI Agents
In .storybook/main.ts around lines 13 to 16, the stories glob only targets
../stories/** so package-level component stories like
packages/design-system/src/**/Level.stories.tsx are omitted; add an additional
glob that expands story discovery to the monorepo packages (e.g., include a
pattern matching packages/**/src/**/*stories.@(js|jsx|mjs|ts|tsx) or similar) so
Storybook loads stories from packages as well, and ensure the new pattern is
placed alongside the existing entries in the stories array.

"addons": [
getAbsolutePath('@chromatic-com/storybook'),
getAbsolutePath('@storybook/addon-docs'),
getAbsolutePath("@storybook/addon-a11y"),
getAbsolutePath("@storybook/addon-vitest")
],
"framework": {
"name": getAbsolutePath('@storybook/react-vite'),
"options": {}
}
};
export default config;
21 changes: 21 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Preview } from '@storybook/react-vite';

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},

a11y: {
// 'todo' - show a11y violations in the test UI only
// 'error' - fail CI on a11y violations
// 'off' - skip a11y checks entirely
test: 'todo',
},
},
};

export default preview;
7 changes: 7 additions & 0 deletions .storybook/vitest.setup.ts
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';
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

setProjectAnnotations import 경로가 잘못되었습니다: '@storybook/react'로 교체 필요

portable stories + Vitest 문서 기준 setProjectAnnotations는 프레임워크 패키지(예: '@storybook/react')가 내보내며, '@storybook/react-vite'는 빌더 프레임워크 이름입니다. 현 상태에선 타입/런타임 오류 가능성이 높습니다.

다음 패치를 적용해 주세요.

-import { setProjectAnnotations } from '@storybook/react-vite';
+import { setProjectAnnotations } from '@storybook/react';
🤖 Prompt for AI Agents
In .storybook/vitest.setup.ts around line 2, the import of setProjectAnnotations
is coming from the wrong package ('@storybook/react-vite'); change the import to
come from the framework package '@storybook/react' instead. Replace the import
source string, update any related type imports if needed, and run
TypeScript/vitest to verify there are no remaining type or runtime import
errors.

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]);
2 changes: 1 addition & 1 deletion apps/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function App() {
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<h1>Vite + React</h1>\
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

TSX 구문 오류: 닫는 태그 뒤 백슬래시 제거 필요

닫는 태그 뒤에 붙은 \ 는 TSX에서 유효하지 않아 빌드/타입체크가 실패할 확률이 높습니다. 단순 오타로 보이니 제거해 주세요.

수정안:

-      <h1>Vite + React</h1>\
+      <h1>Vite + React</h1>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<h1>Vite + React</h1>\
<h1>Vite + React</h1>
🤖 Prompt for AI Agents
In apps/client/src/App.tsx around line 19, there's an extraneous backslash
immediately after the closing <h1> tag which is invalid TSX and will break
compilation; remove the trailing "\" so the line reads a normal closing tag
without any escape characters, and ensure there are no other stray backslashes
or malformed JSX on that line.

<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
Expand Down
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,28 @@
"lint": "turbo run lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"check-types": "turbo run check-types",
"test": "turbo run test"
"test": "turbo run test",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"devDependencies": {
"@chromatic-com/storybook": "^4.1.1",
"@pivanov/vite-plugin-svg-sprite": "^3.1.3",
"@storybook/addon-a11y": "^9.1.3",
"@storybook/addon-docs": "^9.1.3",
"@storybook/addon-vitest": "^9.1.3",
"@storybook/react-vite": "^9.1.3",
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"prettier": "^3.6.2",
"prettier-plugin-tailwindcss": "^0.6.14",
"storybook": "^9.1.3",
"turbo": "^2.5.6",
"typescript": "5.9.2",
"vite": "7.1.2"
"vite": "7.1.2",
"vitest": "^3.2.4",
"@vitest/browser": "^3.2.4",
"playwright": "^1.55.0",
"@vitest/coverage-v8": "^3.2.4"
Comment on lines 14 to +31
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

MDX 블록 컴포넌트를 사용한다면 '@storybook/blocks' 의존성을 추가하세요.

stories/Configure.mdx에서 문서 블록을 사용 중이며, 최신 스토리북에서는 @storybook/addon-docs/blocks 대신 @storybook/blocks 사용이 권장됩니다. 모노레포 혼합 메이저 버전 사용은 팀 규칙(학습 사항)상 허용되므로, @storybook/blocks@^8.x 추가를 권장합니다.

   "devDependencies": {
     "@chromatic-com/storybook": "^4.1.1",
     "@pivanov/vite-plugin-svg-sprite": "^3.1.3",
     "@storybook/addon-a11y": "^9.1.3",
     "@storybook/addon-docs": "^9.1.3",
     "@storybook/addon-vitest": "^9.1.3",
     "@storybook/react-vite": "^9.1.3",
     "@trivago/prettier-plugin-sort-imports": "^5.2.2",
     "prettier": "^3.6.2",
     "prettier-plugin-tailwindcss": "^0.6.14",
+    "@storybook/blocks": "^8.6.14",
     "storybook": "^9.1.3",
     "turbo": "^2.5.6",
     "typescript": "5.9.2",
     "vite": "7.1.2",
     "vitest": "^3.2.4",
     "@vitest/browser": "^3.2.4",
     "playwright": "^1.55.0",
     "@vitest/coverage-v8": "^3.2.4"
   },

참고: 장기 학습에 따라 @storybook/blocks(8.x)와 @storybook/react-vite(9.x)를 혼합해 사용하는 패턴이 유효합니다.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"devDependencies": {
"@chromatic-com/storybook": "^4.1.1",
"@pivanov/vite-plugin-svg-sprite": "^3.1.3",
"@storybook/addon-a11y": "^9.1.3",
"@storybook/addon-docs": "^9.1.3",
"@storybook/addon-vitest": "^9.1.3",
"@storybook/react-vite": "^9.1.3",
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"prettier": "^3.6.2",
"prettier-plugin-tailwindcss": "^0.6.14",
"storybook": "^9.1.3",
"turbo": "^2.5.6",
"typescript": "5.9.2",
"vite": "7.1.2"
"vite": "7.1.2",
"vitest": "^3.2.4",
"@vitest/browser": "^3.2.4",
"playwright": "^1.55.0",
"@vitest/coverage-v8": "^3.2.4"
"devDependencies": {
"@chromatic-com/storybook": "^4.1.1",
"@pivanov/vite-plugin-svg-sprite": "^3.1.3",
"@storybook/addon-a11y": "^9.1.3",
"@storybook/addon-docs": "^9.1.3",
"@storybook/addon-vitest": "^9.1.3",
"@storybook/react-vite": "^9.1.3",
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"prettier": "^3.6.2",
"prettier-plugin-tailwindcss": "^0.6.14",
"@storybook/blocks": "^8.6.14",
"storybook": "^9.1.3",
"turbo": "^2.5.6",
"typescript": "5.9.2",
"vite": "7.1.2",
"vitest": "^3.2.4",
"@vitest/browser": "^3.2.4",
"playwright": "^1.55.0",
"@vitest/coverage-v8": "^3.2.4"
},
🤖 Prompt for AI Agents
In package.json around lines 14 to 31, the project uses MDX document blocks
(stories/Configure.mdx) but lacks the @storybook/blocks dependency; add
"@storybook/blocks": "^8.x" to devDependencies (matching 8.x per guidance), run
your package manager install to update lockfiles, and ensure imports in MDX are
updated from @storybook/addon-docs/blocks to @storybook/blocks if present.

},
"pnpm": {
"overrides": {
Expand Down
1 change: 1 addition & 0 deletions packages/design-system/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { default as Button } from './button/Button';
export { Switch } from './switch/Switch';
export { default as Input } from './input/Input';
export { default as Level } from './level/Level';
export { Textarea } from './textarea/Textarea';
export { Progress } from './progress/Progress';
33 changes: 33 additions & 0 deletions packages/design-system/src/components/level/Level.stories.tsx
Copy link
Member

Choose a reason for hiding this comment

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

parameterslayout: 'centered'추가해서 중앙 정렬해서 통일하면 좋을 것 같아요 👍

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Story 타입 import 대상이 잘못되었습니다.

스토리 파일에서는 타입을 @storybook/react에서 가져와야 합니다. 현재 @storybook/react-vite에서 가져오고 있어 TS 타입 확인/자동 문서화에 문제가 생길 수 있습니다.

-import type { Meta, StoryObj } from '@storybook/react-vite';
+import type { Meta, StoryObj } from '@storybook/react';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import type { Meta, StoryObj } from '@storybook/react-vite';
import type { Meta, StoryObj } from '@storybook/react';
🤖 Prompt for AI Agents
In packages/design-system/src/components/level/Level.stories.tsx around line 1,
the Story types are imported from the wrong package; replace the type import
from '@storybook/react-vite' with types from '@storybook/react' (i.e. import
Meta and StoryObj from '@storybook/react' instead of '@storybook/react-vite') so
TypeScript type checking and autogenerated docs work correctly; update the
import statement accordingly and run type checks to confirm.

import Level from './Level';

const meta: Meta<typeof Level> = {
title: 'Components/Level',
component: Level,
tags: ['autodocs'],
parameters: {
layout: 'centered',
},
argTypes: {
level: {
control: { type: 'number', min: 1, max: 100 },
description: '현재 레벨 값',
},
},
};
export default meta;

type Story = StoryObj<typeof Level>;

// 기본 예시
export const Default: Story = {
args: {
level: 1,
},
};

export const Level10: Story = {
args: {
level: 10,
},
};
12 changes: 12 additions & 0 deletions packages/design-system/src/components/level/Level.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
interface LevelProps {
level: number;
}
const Level = ({ level }: LevelProps) => {
return (
<span className="caption2-sb text-main600 bg-main100 rounded-[0.4rem] px-[0.8rem] py-[0.2rem]">
Lv.{level}
</span>
);
};

export default Level;
49 changes: 49 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';

import { defineConfig } from 'vitest/config';

import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';

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({
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' }],
},
Comment on lines +26 to +31
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Playwright 런타임/브라우저 설치 확인 필요

provider가 'playwright'이므로 devDependencies에 playwright-core 또는 @playwright/test가 설치되어야 하며, 브라우저 바이너리(chromium)도 사전 설치가 필요합니다. 패키지 누락/브라우저 미설치 시 CI에서 바로 실패합니다.

다음 스크립트로 의존성 여부를 점검해 주세요(리포지토리 루트에서 실행).


🏁 Script executed:

#!/bin/bash
# devDependencies에 playwright 관련 패키지 확인
rg -n '"devDependencies"\s*:\s*{[^}]*}' -N package.json | sed -n '1p'
rg -nP '"(@?playwright/(test|.*)|playwright(-core)?)"\s*:\s*"[^\"]+"' package.json -n -C1

# 스토리북/비텟 플러그인 존재 확인
rg -n "@storybook/addon-vitest|vitest-plugin" package.json -n -C1

# (참고) 로컬에서는 아래로 브라우저 설치
echo "Install browsers: npx playwright install chromium"

Length of output: 712


Playwright 런타임 및 브라우저 바이너리 설치 확인 필요

  • package.json(devDependencies)에 이미 playwright 패키지가 등록되어 있어 런타임은 확보된 상태입니다.
  • CI 환경에서 Chromium 바이너리가 설치되지 않으면 브라우저 테스트가 바로 실패하니, CI 워크플로나 설치 스크립트에 아래 명령을 반드시 포함해 주세요.
    npx playwright install chromium
    
  • 또한 스토리북용 Vitest 통합 플러그인(@storybook/addon-vitest)도 이미 설치되어 있습니다.
🤖 Prompt for AI Agents
In vitest.config.ts around lines 26 to 31 the Playwright browser is enabled for
headless Chromium but CI may not have the Chromium binary installed; update
CI/workflow or project install scripts to run the Playwright browser installer
(e.g. run "npx playwright install chromium") before tests execute and verify
playwright is present in devDependencies (and that any Storybook Vitest plugin
is installed) so tests won't fail due to missing browser binaries.

setupFiles: ['.storybook/vitest.setup.ts'],
},
},
],
},
});
1 change: 1 addition & 0 deletions vitest.shims.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@vitest/browser/providers/playwright" />
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

타입 참조 경로 유효성 및 의존성 확인

삼중 슬래시 타입 참조는 간단하지만, 해당 타입 패키지들이 실제 의존성에 존재해야 합니다. 루트 혹은 워크스페이스 패키지에 @vitest/browserplaywright(또는 @playwright/test)가 devDependency로 포함되어 있는지 확인해 주세요. 또한 tsconfig.jsoninclude가 이 파일을 포함하는지도 점검이 필요합니다.

다음 스크립트로 모든 패키지에서 의존성 존재 여부를 점검할 수 있습니다:


🏁 Script executed:

#!/bin/bash
# 모든 package.json에서 관련 의존성 확인
set -euo pipefail
fd -H -E "node_modules" "package.json" | while read -r pkg; do
  echo "==> $pkg"
  jq -r '
    {
      deps: (.dependencies // {}) + (.devDependencies // {}),
      name: .name
    } as $p
    | $p.name,
      (["  vitest: ",   ( ($p.deps.vitest // "MISSING")       | tostring )] | join("")),
      (["  @vitest/browser: ", ( ($p.deps["@vitest/browser"] // "MISSING") | tostring )] | join("")),
      (["  playwright or @playwright/test: ", ( ($p.deps.playwright // ($p.deps["@playwright/test"] // "MISSING")) | tostring )] | join(""))
  ' "$pkg"
done

echo
echo "tsconfig include에 vitest.shims.d.ts가 포함되는지 확인:"
fd -H -E "node_modules" "tsconfig*.json" | while read -r ts; do
  echo "==> $ts"
  jq '.include // []' "$ts"
done

Length of output: 845


jq 문법 오류로 인해 의존성 확인 스크립트가 실패했습니다. 아래 스크립트로 다시 실행하여 @vitest/browserplaywright(또는 @playwright/test)가 devDependency에 포함되어 있는지, 그리고 tsconfig.jsonincludevitest.shims.d.ts가 포함되는지 확인해 주세요.


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# 모든 package.json에서 관련 의존성 확인
fd -H -E "node_modules" "package.json" | while read -r pkg; do
  echo "==> $pkg"
  vitest_ver=$(jq -r '.dependencies.vitest // .devDependencies.vitest // "MISSING"' "$pkg")
  browser_ver=$(jq -r '.dependencies["@vitest/browser"] // .devDependencies["@vitest/browser"] // "MISSING"' "$pkg")
  play_ver=$(jq -r '.dependencies.playwright // .dependencies["@playwright/test"] // .devDependencies.playwright // .devDependencies["@playwright/test"] // "MISSING"' "$pkg")
  echo "  vitest: $vitest_ver"
  echo "  @vitest/browser: $browser_ver"
  echo "  playwright or @playwright/test: $play_ver"
done

echo
# tsconfig include에 vitest.shims.d.ts가 포함되는지 확인
fd -H -E "node_modules" "tsconfig*.json" | while read -r ts; do
  echo "==> $ts"
  jq -r '.include // []' "$ts"
done

Length of output: 7088


devDependencies 및 tsconfig 설정 보강 필요

다음 두 가지 항목을 점검하고 부족한 부분을 보강해 주세요:

• devDependencies 확인
– 루트(package.json)와 packages/design-system에는 이미
• vitest: ^3.2.4
• @vitest/browser: ^3.2.4
• playwright (또는 @playwright/test): ^1.55.0
이 포함되어 있습니다.
– 하지만 아래 패키지들에서는 모두 MISSING으로 나타났습니다.
• apps/client
• apps/extension
• apps/landing
• packages/eslint-config
• packages/tailwind-config
• packages/typescript-config
– 각 패키지에서 브라우저용 Vitest(type provider)와 Playwright 타입을 사용하려면, 해당 패키지의 devDependencies에 위 세 가지를 추가하거나, 패키지 매니저(예: pnpm-workspace) 설정을 통해 루트 의존성을 올바르게 호이스트하는지 확인해야 합니다.

• tsconfig.json의 include 설정
vitest.shims.d.ts 파일을 실제로 타입 검사에 포함시키려면, 각 tsconfig.json 또는 공통 상위 tsconfig.base.json의 include 배열에 아래처럼 추가해야 합니다.
diff { "include": [ "src", "vite.config.ts", + "vitest.shims.d.ts" ] }
– 현재 apps/client, apps/extension, apps/landing, packages/design-system 등 모든 하위 tsconfig.json에서 해당 파일이 빠져 있으므로, 테스트 환경에서 타입이 인식되지 않을 수 있습니다.

위 두 항목을 반영한 뒤, 테스트가 정상 실행되는지 확인해 주세요.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In vitest.shims.d.ts around lines 1 to 1, the repo is missing browser Vitest and
Playwright types in several package devDependencies and the shims file is not
included in tsconfig includes; update each affected package (apps/client,
apps/extension, apps/landing, packages/eslint-config, packages/tailwind-config,
packages/typescript-config) to either add devDependencies for vitest,
@vitest/browser and playwright (or @playwright/test) or ensure your
workspace/pnpm hoisting exposes the root versions to those packages, and add the
path to vitest.shims.d.ts into the include array of each package tsconfig.json
(or the shared tsconfig.base.json) so the type provider is picked up; after
making these changes, run the test suite to confirm types and tests load
correctly.

Loading