Skip to content

fix: token 스크립트 수정#8

Closed
dasosann wants to merge 1 commit intomainfrom
feat/background-blur
Closed

fix: token 스크립트 수정#8
dasosann wants to merge 1 commit intomainfrom
feat/background-blur

Conversation

@dasosann
Copy link
Copy Markdown
Contributor

@dasosann dasosann commented Jan 26, 2026

User description

요약

🤖 Generated by PR Agent at 354fd18

  • 디자인 토큰 자동 생성 스크립트 구현으로 토큰 관리 자동화
  • token.json에서 CSS 변수로 변환하는 generate-tokens.js 스크립트 추가
  • 생성된 tokens.cssglobals.css에 임포트하여 전역 스타일 적용
  • 테스트 페이지에서 타이포그래피, 색상, 버튼 토큰 시각화

구현 사항

Relevant files
Enhancement
generate-tokens.js
토큰 JSON을 CSS 변수로 변환하는 생성 스크립트                                                       

scripts/generate-tokens.js

  • token.json에서 색상, 타이포그래피, 반경, 테두리, 불투명도 토큰 파싱
  • CSS 변수 형식으로 변환하여 tokens.css 자동 생성
  • 토큰 참조 해석 기능으로 의미론적 토큰 지원
  • 텍스트 유틸리티 클래스 text-{size}-{weight} 형식 생성
+214/-0 
tokens.css
자동 생성된 CSS 변수 및 유틸리티 클래스                                                                 

app/tokens.css

  • 자동 생성된 CSS 파일로 모든 디자인 토큰을 CSS 변수로 정의
  • 색상(그레이스케일, 핑크, 플레임, 오렌지) 변수 260줄 포함
  • 타이포그래피 유틸리티 클래스 text-{size}-{weight} 제공
  • 배경, 버튼, 테두리, 텍스트 색상 유틸리티 클래스 정의
+260/-0 
globals.css
토큰 CSS 파일 임포트 추가                                                                                 

app/globals.css

  • tokens.css 임포트 추가로 생성된 토큰 전역 적용
  • 따옴표 스타일 일관성 개선 (작은따옴표 → 큰따옴표)
+2/-1     
page.tsx
디자인 토큰 테스트 및 시각화 페이지                                                                         

app/page.tsx

  • 기존 Next.js 템플릿 코드 제거 및 토큰 테스트 페이지로 전환
  • 타이포그래피, 색상, 배경, 버튼 토큰 시각화 섹션 추가
  • 생성된 CSS 유틸리티 클래스 실제 사용 예시 제공
  • 디자인 토큰 시스템 검증용 데모 페이지 구성
+55/-57 
Configuration changes
settings.json
CSS 린트 설정 업데이트                                                                                     

.vscode/settings.json

  • CSS 린트 규칙 unknownAtRules 무시 설정 추가
  • @layer 등 커스텀 CSS 규칙 경고 제거
+2/-1     
Miscellaneous
token.json
레거시 토큰 파일 제거                                                                                         

app/src/token.json

  • 기존 토큰 파일 삭제 (위치 이동)
+0/-1279

Need Review

  • ~ 부분 이렇게 구현했어요, 피드백 부탁해요!

Reference

📜 리뷰 규칙

Reviewer는 아래 P5 Rule을 참고하여 리뷰를 진행합니다.
P5 Rule을 통해 Reviewer는 Reviewee에게 리뷰의 의도를 보다 정확히 전달할 수 있습니다.

  • P1: 꼭 반영해주세요 (Comment)
  • P2: 적극적으로 고려해주세요 (Comment)
  • P3: 웬만하면 반영해 주세요 (Comment)
  • P4: 반영해도 좋고 넘어가도 좋습니다 (Approve)
  • P5: 그냥 사소한 의견입니다 (Approve)

PR Type

Enhancement


Description

  • 디자인 토큰 자동 생성 스크립트로 토큰 관리 자동화

  • token.json을 CSS 변수로 변환하는 generate-tokens.js 스크립트 추가

  • 생성된 tokens.css를 전역 스타일에 통합하여 디자인 시스템 구축


Diagram Walkthrough

flowchart LR
  A["token.json<br/>디자인 토큰 정의"] -->|"generate-tokens.js<br/>파싱 및 변환"| B["tokens.css<br/>CSS 변수 생성"]
  B -->|"@import"| C["globals.css<br/>전역 스타일 적용"]
  C -->|"클래스명 사용"| D["page.tsx<br/>컴포넌트 스타일링"]
Loading

File Walkthrough

Relevant files
Enhancement
generate-tokens.js
토큰 JSON을 CSS 변수로 변환하는 생성 스크립트                                                       

scripts/generate-tokens.js

  • token.json에서 색상, 타이포그래피, 반경, 테두리, 불투명도 토큰 파싱
  • CSS 변수 형식으로 변환하여 tokens.css 자동 생성
  • 토큰 참조 해석 기능으로 의미론적 토큰 지원
  • text-{size}-{weight} 형식의 타이포그래피 유틸리티 클래스 생성
+214/-0 
tokens.css
자동 생성된 CSS 변수 및 유틸리티 클래스                                                                 

app/tokens.css

  • 자동 생성된 CSS 파일로 모든 디자인 토큰을 CSS 변수로 정의
  • 그레이스케일, 핑크, 플레임, 오렌지 색상 변수 포함
  • text-{size}-{weight} 타이포그래피 유틸리티 클래스 제공
  • 배경, 버튼, 테두리, 텍스트 색상 유틸리티 클래스 정의
+260/-0 
page.tsx
디자인 토큰 테스트 페이지로 변경                                                                             

app/page.tsx

  • 기존 Next.js 템플릿 코드 제거
  • 디자인 토큰 시각화 테스트 페이지로 전환
  • 타이포그래피, 색상, 배경, 버튼 토큰 실제 사용 예시 제공
  • 토큰 기반 클래스명으로 스타일링 적용
+55/-57 
Configuration changes
globals.css
토큰 CSS 파일 임포트 추가                                                                                 

app/globals.css

  • tokens.css 파일 임포트 추가
  • 따옴표 스타일 통일 (작은따옴표 → 큰따옴표)
+2/-1     
settings.json
CSS 린트 설정 추가                                                                                         

.vscode/settings.json

  • CSS 린트 규칙 추가: css.lint.unknownAtRules 설정
  • @layer 등 커스텀 CSS 규칙 경고 무시
+2/-1     
Miscellaneous
token.json
토큰 파일 위치 변경                                                                                           

app/src/token.json

  • 기존 토큰 파일 삭제
  • 새로운 위치(app/token.json)로 이동
+0/-1279

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @dasosann, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 프로젝트의 디자인 토큰 관리 시스템을 개선하는 데 중점을 둡니다. 기존의 정적 JSON 파일 사용 방식에서 벗어나, 스크립트를 통해 CSS 변수와 유틸리티 클래스를 동적으로 생성하는 방식으로 전환하여 디자인 일관성과 개발 효율성을 높였습니다. 새로운 토큰 시스템의 적용을 시각적으로 검증할 수 있는 테스트 페이지도 함께 제공됩니다.

Highlights

  • 디자인 토큰 관리 방식 변경: 기존 token.json 파일을 직접 사용하는 대신, scripts/generate-tokens.js 스크립트를 통해 app/tokens.css 파일을 자동 생성하여 디자인 토큰을 관리하도록 변경되었습니다.
  • 디자인 토큰 CSS 통합: 생성된 tokens.css 파일이 app/globals.css에 임포트되어 전역 스타일로 적용됩니다. 이를 통해 Tailwind CSS 유틸리티 클래스처럼 디자인 토큰을 사용할 수 있습니다.
  • 디자인 토큰 테스트 페이지 추가: app/page.tsx 파일의 내용이 완전히 재작성되어, 새로운 디자인 토큰 시스템(타이포그래피, 색상, 배경, 버튼 등)을 시각적으로 확인할 수 있는 테스트 페이지로 대체되었습니다.
  • VS Code 설정 업데이트: .vscode/settings.jsoncss.lint.unknownAtRules 설정을 추가하여, 디자인 토큰 관련 사용자 정의 CSS 규칙에 대한 린트 경고를 무시하도록 구성했습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dasosann
Copy link
Copy Markdown
Contributor Author

/describe --pr_description.generate_title=true --pr_description.use_description_markers=false

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Jan 26, 2026

PR Description updated to latest commit (354fd18)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

File Walkthrough

Enhancement
generate-tokens.js (+214/-0)
토큰 JSON을 CSS 변수로 변환하는 생성 스크립트                                                       

scripts/generate-tokens.js

  • token.json에서 색상, 타이포그래피, 반경, 테두리, 불투명도 토큰 파싱
  • CSS 변수 형식으로 변환하여 tokens.css 자동 생성
  • 토큰 참조 해석 기능으로 의미론적 토큰 지원
  • text-{size}-{weight} 형식의 타이포그래피 유틸리티 클래스 생성
tokens.css (+260/-0)
자동 생성된 CSS 변수 및 유틸리티 클래스                                                                 

app/tokens.css

  • 자동 생성된 CSS 파일로 모든 디자인 토큰을 CSS 변수로 정의
  • 그레이스케일, 핑크, 플레임, 오렌지 색상 변수 포함
  • text-{size}-{weight} 타이포그래피 유틸리티 클래스 제공
  • 배경, 버튼, 테두리, 텍스트 색상 유틸리티 클래스 정의
page.tsx (+55/-57)
디자인 토큰 테스트 페이지로 변경                                                                             

app/page.tsx

  • 기존 Next.js 템플릿 코드 제거
  • 디자인 토큰 시각화 테스트 페이지로 전환
  • 타이포그래피, 색상, 배경, 버튼 토큰 실제 사용 예시 제공
  • 토큰 기반 클래스명으로 스타일링 적용
Configuration changes
globals.css (+2/-1)
토큰 CSS 파일 임포트 추가                                                                                 

app/globals.css

  • tokens.css 파일 임포트 추가
  • 따옴표 스타일 통일 (작은따옴표 → 큰따옴표)
settings.json (+2/-1)
CSS 린트 설정 추가                                                                                         

.vscode/settings.json

  • CSS 린트 규칙 추가: css.lint.unknownAtRules 설정
  • @layer 등 커스텀 CSS 규칙 경고 무시
Miscellaneous
token.json (+0/-1279)
토큰 파일 위치 변경                                                                                           

app/src/token.json

  • 기존 토큰 파일 삭제
  • 새로운 위치(app/token.json)로 이동

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

안녕하세요. 디자인 토큰 자동 생성 스크립트 도입을 위한 수고에 감사드립니다. 전반적으로 토큰 관리 자동화의 방향성은 매우 훌륭합니다. 리뷰에서는 주로 생성 스크립트의 유지보수성을 높이기 위한 리팩토링, 토큰 값의 정확한 사용, 그리고 테스트 페이지의 접근성 및 스타일 정확성 개선에 초점을 맞추었습니다. 제안드린 내용을 반영하시면 더 견고하고 확장성 있는 디자인 시스템 기반을 마련할 수 있을 것입니다.

Comment on lines +37 to +57
if (colors.Pink) {
Object.entries(colors.Pink).forEach(([key, value]) => {
if (key.startsWith("color-pink-")) {
cssVariables.push(` --${sanitizeKey(key)}: ${value.$value};`);
}
});
}
if (colors.Flame) {
Object.entries(colors.Flame).forEach(([key, value]) => {
if (key.startsWith("color-flame-")) {
cssVariables.push(` --${sanitizeKey(key)}: ${value.$value};`);
}
});
}
if (colors.Orange) {
Object.entries(colors.Orange).forEach(([key, value]) => {
if (key.startsWith("color-orange-")) {
cssVariables.push(` --${sanitizeKey(key)}: ${value.$value};`);
}
});
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Pink, Flame, Orange 색상 토큰을 처리하는 로직이 중복되고 있습니다. 이는 새로운 색상 카테고리가 추가될 때마다 코드를 복사-붙여넣기 해야 하므로 유지보수성을 저해합니다. 이 부분을 배열과 반복문으로 리팩토링하여 코드 중복을 제거하고 확장성을 높이는 것을 권장합니다.

const colorCategories = ["Pink", "Flame", "Orange"];
colorCategories.forEach((category) => {
  if (colors[category]) {
    const prefix = `color-${category.toLowerCase()}-`;
    Object.entries(colors[category]).forEach(([key, value]) => {
      if (key.startsWith(prefix)) {
        cssVariables.push(`  --${sanitizeKey(key)}: ${value.$value};`);
      }
    });
  }
});
References
  1. 중복 코드를 발견하면 재사용 가능한 유틸리티나 로직으로 추출할 것을 제안해야 합니다. 현재 색상 카테고리(Pink, Flame, Orange)를 처리하는 로직이 거의 동일하게 반복되고 있어 이 규칙에 위배됩니다. (link)

Comment on lines +114 to +125
if (ref.startsWith("Colors.Pink.")) {
const key = ref.replace("Colors.Pink.", "");
return `var(--${key})`;
}
if (ref.startsWith("Colors.Flame.")) {
const key = ref.replace("Colors.Flame.", "");
return `var(--${key})`;
}
if (ref.startsWith("Colors.Orange.")) {
const key = ref.replace("Colors.Orange.", "");
return `var(--${key})`;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

resolveValue 함수 내에서 Colors.Pink, Colors.Flame, Colors.Orange 에 대한 참조를 처리하는 로직이 중복되어 있습니다. 이 또한 코드의 유지보수성을 낮추는 요인이 됩니다. 여러 if 문을 하나로 통합하여 더 간결하고 일반적인 방식으로 처리하도록 리팩토링하는 것이 좋습니다.

  if (ref.startsWith("Colors.Pink.") || ref.startsWith("Colors.Flame.") || ref.startsWith("Colors.Orange.")) {
    const key = ref.substring(ref.lastIndexOf('.') + 1);
    return `var(--${sanitizeKey(key)})`;
  }
References
  1. 중복 코드를 발견하면 재사용 가능한 유틸리티나 로직으로 추출할 것을 제안해야 합니다. resolveValue 함수 내에서 여러 색상 카테고리에 대한 참조를 처리하는 if 블록들이 반복되고 있어 이 규칙에 위배됩니다. (link)

Comment on lines +48 to +56
<button className="btn-primary text-16-600 px-8 py-3 transition-opacity hover:opacity-90">
Primary Button
</button>
<button className="btn-slate text-brand-black border-light text-16-600 rounded-2xl border px-8 py-3">
Secondary Button
</button>
<button className="btn-disabled text-16-400 cursor-not-allowed px-8 py-3">
Disabled Button
</button>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

버튼 컴포넌트의 클래스명과 접근성에 몇 가지 개선점이 필요해 보입니다.

  1. 잘못된 클래스명: btn-primary, btn-slate 등의 클래스명이 사용되었지만, tokens.css에는 bg-button-primary와 같이 배경색을 지정하는 유틸리티 클래스가 정의되어 있습니다. 이로 인해 버튼의 배경 스타일이 적용되지 않고 있습니다.
  2. 스타일 누락: Primary 버튼의 경우, 배경 그래디언트가 적용되면 가독성을 위해 text-white 클래스를 추가해야 합니다. 또한 다른 버튼들과의 일관성을 위해 rounded-2xl을 추가하는 것이 좋습니다.
  3. Disabled 버튼 접근성: disabled 속성 없이 cursor-not-allowed 클래스만 사용하면, 시각적으로는 비활성화된 것처럼 보이지만 스크린 리더 사용자에게는 여전히 클릭 가능한 버튼으로 인식됩니다. 웹 접근성을 준수하기 위해 disabled 속성을 명시적으로 추가해야 합니다.
Suggested change
<button className="btn-primary text-16-600 px-8 py-3 transition-opacity hover:opacity-90">
Primary Button
</button>
<button className="btn-slate text-brand-black border-light text-16-600 rounded-2xl border px-8 py-3">
Secondary Button
</button>
<button className="btn-disabled text-16-400 cursor-not-allowed px-8 py-3">
Disabled Button
</button>
<button className="bg-button-primary text-white text-16-600 rounded-2xl px-8 py-3 transition-opacity hover:opacity-90">
Primary Button
</button>
<button className="bg-button-slate text-brand-black border-light text-16-600 rounded-2xl border px-8 py-3">
Secondary Button
</button>
<button className="bg-button-disabled text-disabled text-16-400 cursor-not-allowed rounded-2xl px-8 py-3" disabled>
Disabled Button
</button>
References
  1. 아이콘 전용 버튼의 aria-label 등 접근성(A11y) 관련 사항을 확인해야 합니다. 현재 비활성화 버튼이 disabled 속성 없이 스타일로만 처리되어 있어 스크린 리더 사용자가 이를 인지할 수 없으므로 접근성 표준에 위배됩니다. (link)

Comment on lines +9 to +10
const tokensPath = path.join(__dirname, "../app/token.json");
const tokens = JSON.parse(fs.readFileSync(tokensPath, "utf-8"));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

토큰 생성 스크립트는 현재 파일 시스템 작업이나 JSON 파싱에서 발생할 수 있는 오류를 처리하지 않습니다. 예를 들어 token.json 파일이 없거나 내용이 잘못된 경우 스크립트가 비정상적으로 종료됩니다. try...catch 블록을 사용하여 오류를 적절히 처리하고 사용자에게 명확한 에러 메시지를 보여주는 것이 스크립트의 안정성을 높이는 데 도움이 됩니다.

Suggested change
const tokensPath = path.join(__dirname, "../app/token.json");
const tokens = JSON.parse(fs.readFileSync(tokensPath, "utf-8"));
const tokensPath = path.join(__dirname, "../app/token.json");
let tokens;
try {
tokens = JSON.parse(fs.readFileSync(tokensPath, "utf-8"));
} catch (error) {
console.error(`❌ Error reading or parsing ${tokensPath}:`, error.message);
process.exit(1);
}

Comment on lines +152 to +156
tailwindUtilities.push(`${className} {
font-size: ${size}px;
font-weight: ${weight};
line-height: 1.5;
}`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

타이포그래피 유틸리티 클래스 생성 시 line-height1.5로 하드코딩되어 있습니다. token.json 파일에 lineHeights 토큰이 정의되어 있음에도 이를 사용하지 않는 것은 토큰 시스템의 일관성을 해칠 수 있습니다. 스크립트가 token.jsonlineHeights 값을 읽어와 동적으로 line-height를 설정하도록 수정하는 것을 고려해 보세요.

@dasosann dasosann closed this Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant