-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add ref
value to alpha javascript token object output & Refactor build scripts
#2135
Conversation
🦋 Changeset detectedLatest commit: 8ebed4f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2135 +/- ##
=======================================
Coverage 86.63% 86.63%
=======================================
Files 126 126
Lines 2656 2656
Branches 778 791 +13
=======================================
Hits 2301 2301
+ Misses 350 326 -24
- Partials 5 29 +24 ☔ View full report in Codecov by Sentry. |
ref
value to alpha javascript token object output & Refactor build scripts
…custom javascript format
7431cb5
to
d8f54de
Compare
Chromatic Report🚀 Congratulations! Your build was successful! |
"typesVersions": { | ||
"*": { | ||
"alpha": [ | ||
"./dist/types/alpha/cjs/index.d.ts" | ||
] | ||
} | ||
}, |
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.
typescript moduleResolution node 인 경우, exports 필드를 제대로 참조하지 못해서 추가하였습니다. (bezier-react와 마찬가지)
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.
- .mts -> .ts 변경 : 빌드 스크립트를 패키지 스크립트가 아닌 build-tokens.ts 내부에서 수행하도록 변경하면서, 모듈 시스템을 CJS로 맞추기 위해 변경했습니다. 여기서 chalk 패키지를 사용하게 되면, 모듈 시스템 통일에 문제가 생겨서 다시 제거했습니다. (크게 중요치 않다고 판단함)
- 동기에서 비동기로 로직 변경
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.
모듈 시스템을 ESM이 아닌 CJS로 맞추는 이유가 무엇인지 궁금합니다
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.
CJS로 맞춘다기보다는 초기에 패키지를 설정할 때 CJS로 맞춰져있었기에 그렇습니다. type="module" 을 추가하여 패키지 전체를 ESM으로 변경할 수도 있는데, 빌드 과정에서 확장자 변경 등 추가적인 공수가 들어가요. 'chalk 패키지를 추가하기 위해서' 이 공수를 더 들일 필요는 없다고 생각해서 제거했습니다.
@@ -44,6 +71,7 @@ interface DefineConfigOptions { | |||
} | |||
|
|||
function defineConfig({ | |||
useAlpha = false, |
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.
Alpha 버전에만 다른 포매터를 사용하기 위한 플래그
.map((token) => { | ||
const ref = (() => { | ||
if (!dictionary.usesReference(token.original.value)) { | ||
return null | ||
} | ||
|
||
let value = token.value as string | number | null | ||
|
||
// NOTE: make sure to use `token.original.value` because | ||
// `token.value` is already resolved at this point. | ||
dictionary | ||
.getReferences(token.original.value) | ||
.forEach((ref) => { | ||
value = value | ||
?.toString() | ||
.replace(ref.value, ref.name) as string | ||
}) | ||
|
||
return value | ||
})() | ||
|
||
return ` "${token.name}": Object.freeze(${JSON.stringify({ value: token.value, ref })}),` | ||
}) |
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.
기존 JS 커스텀 포맷과 이 부분만 다릅니다.
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.
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.
undefined로 둘 지 null로 둘 지 고민이었는데, 레퍼런스가 없다는 점을 의도적으로 잘 드러내기 위해선 null 쪽이 더 적합하다고 생각했어요. ref
뿐만 아니라 존재하지 않는 다른 key에 접근할 때도 모두 undefined가 나올테니까요
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.
- build-css-index.mts -> merge-css.ts 로 이름 변경. 더 적절한 이름이라고 판단했습니다.
- 그 외 JS 변경사항과 동일
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @channel.io/[email protected] ### Minor Changes - Add `ref` value to design tokens of alpha version. ([#2135](#2135)) by @sungik-choi - Add design tokens for next(alpha) version. ([#2132](#2132)) by @sungik-choi ### Patch Changes - Modify alpha design tokens according to figma design ([#2138](#2138)) by @yangwooseong ## @channel.io/[email protected] ### Patch Changes - The style sheet(styles.css) now includes the alpha version of the design token. ([#2141](#2141)) by @sungik-choi - Remove the `/alpha` directory and add the `Alpha` prefix to alpha components. ([#2140](#2140)) by @sungik-choi - `TooltipPrimitive` -> `AlphaTooltipPrimitive` - `DialogPrimitive` -> `AlphaDialogPrimitive` - Updated dependencies - @channel.io/[email protected] ## [email protected] ### Patch Changes - Updated dependencies - @channel.io/[email protected] Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Self Checklist
Related Issue
Summary
ref
값을 추가합니다. resolve가 완료된(value
) 값 외에도 어떤 값을 참조했는지 알 수 있도록 하기 위해서입니다. Stable 버전에는 영향을 주지 않도록 알파 버전의 디자인 토큰에만 적용했습니다.Details
Breaking change? (Yes/No)
No
References