-
Notifications
You must be signed in to change notification settings - Fork 0
[CHORE] 디자인 시스템 절대경로(path alias) 설정 #70
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
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 |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| import path from "node:path"; | ||
|
|
||
| import type { StorybookConfig } from "@storybook/react-vite"; | ||
|
|
||
| const config: StorybookConfig = { | ||
|
|
@@ -15,6 +17,20 @@ const config: StorybookConfig = { | |
| docs: { | ||
| autodocs: "tag", | ||
| }, | ||
| viteFinal: async (config) => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TypeScript랑 Vite는 별개라서 둘 다 따로 alias를 알려줘야하는군요....!! |
||
| config.resolve ??= {}; | ||
| config.resolve.alias = { | ||
| ...config.resolve.alias, | ||
| "@components": path.resolve(__dirname, "../src/components"), | ||
| "@tokens": path.resolve(__dirname, "../src/tokens"), | ||
| "@icons": path.resolve(__dirname, "../src/icons"), | ||
| "@lib": path.resolve(__dirname, "../src/lib"), | ||
| "@styles": path.resolve(__dirname, "../src/styles"), | ||
| "@assets": path.resolve(__dirname, "../src/assets"), | ||
| "@guides": path.resolve(__dirname, "../src/guides"), | ||
| }; | ||
| return config; | ||
| }, | ||
| }; | ||
|
|
||
| export default config; | ||
3 changes: 2 additions & 1 deletion
3
packages/timo-design-system/src/components/color/Color.stories.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/timo-design-system/src/components/priority-icon/PriorityIcon.tsx
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { cn } from "../../lib"; | ||
| import { cn } from "@lib"; | ||
|
|
||
| export type Priority = | ||
| | "매우중요" | ||
|
|
||
3 changes: 2 additions & 1 deletion
3
packages/timo-design-system/src/components/typography/Typography.stories.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/timo-design-system/src/components/typography/Typography.tsx
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
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😍👍 |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
tsconfig.json paths와 이중 관리되는 alias —
vite-tsconfig-paths플러그인 사용 고려.tsconfig.json의paths와 이 파일의resolve.alias가 동일한 매핑을 각각 수동 관리하고 있어, 향후 새 폴더/별칭 추가 시 두 곳을 동시에 갱신하지 않으면 설정이 어긋날 위험이 있습니다.vite-tsconfig-paths플러그인을 사용하면tsconfig.json의paths를 단일 소스로 삼아 Vite alias를 자동 동기화할 수 있습니다.참고: https://github.com/aleclarson/vite-tsconfig-paths
♻️ 참고 리팩터링 예시
참고로 현재 Storybook 버전(8.6.14) 기준
__dirname은 Vite 빌더의 CJS 트랜스파일 컨텍스트에서 정상 동작하지만, Storybook 10부터는 main config가 순수 ESM으로 강제되어__dirname/__filename이 제거될 예정이니 향후 업그레이드 시 유의하세요.Also applies to: 20-33
🤖 Prompt for AI Agents