chore: Migrate typography tokens to use stable hashes - #4845
Conversation
| const variablesMap = { | ||
| borderRadiusButton: 'border-radius-button', | ||
| borderWidthField: 'border-width-field', | ||
| colorChartsPurple300: 'color-charts-purple-300', |
There was a problem hiding this comment.
Adding more token examples; I feel like I'll probably release the color token changes in smaller batches than all of "color-*" at once.
There was a problem hiding this comment.
Pull request overview
Migrates typography design tokens to the stable-hash versioning scheme (suffix derived from token name + package version rather than token value), continuing the phased rollout that previously migrated border tokens.
Changes:
- Expanded the default token version groups to include typography-related CSS variable prefixes (
font-,letter-spacing-,line-height-). - Updated unit tests for
getTokenVersionsto reflect the expanded default group behavior and additional matching scenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| build-tools/utils/token-versions.js | Adds typography token prefix patterns to the default stable-hash version group list. |
| build-tools/utils/tests/token-versions.test.js | Extends fixtures/expectations for the updated grouping logic and first-match behavior. |
Comments suppressed due to low confidence (1)
build-tools/utils/tests/token-versions.test.js:26
- With the added
letter-spacing-*andline-height-*fixtures, this expectation should assert they get versioned by the default groups as well.
expect(getTokenVersions(variablesMap)).toEqual({
borderRadiusButton: 'v3-1',
borderWidthField: 'v3-1',
fontFamilyBase: 'v3-1',
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4845 +/- ##
=======================================
Coverage 97.63% 97.63%
=======================================
Files 957 957
Lines 31097 31097
Branches 11435 11434 -1
=======================================
Hits 30361 30361
- Misses 689 729 +40
+ Partials 47 7 -40 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Description
See cloudscape-design/theming-core#190. We want design token CSS variable names to be more stable, and introducing a new stable method of determining the token suffix (based on token name and package version, not the value).
Out of an abundance of caution, we're migrating tokens in batches. A previous PR (#4718, merged 2 weeks ago) migrated all border tokens. This PR does the same for typography tokens.
Related links, issue #, if available: rzZV6TJY6Zav (Chorus)
How has this been tested?
Will dry-run build this just in case.
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md.CONTRIBUTING.md.Security
checkSafeUrlfunction.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.