Skip to content

chore: Migrate typography tokens to use stable hashes - #4845

Open
avinashbot wants to merge 3 commits into
mainfrom
migrate-tokens-suffix-1
Open

chore: Migrate typography tokens to use stable hashes#4845
avinashbot wants to merge 3 commits into
mainfrom
migrate-tokens-suffix-1

Conversation

@avinashbot

@avinashbot avinashbot commented Jul 29, 2026

Copy link
Copy Markdown
Member

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

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

const variablesMap = {
borderRadiusButton: 'border-radius-button',
borderWidthField: 'border-width-field',
colorChartsPurple300: 'color-charts-purple-300',

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Adding more token examples; I feel like I'll probably release the color token changes in smaller batches than all of "color-*" at once.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 getTokenVersions to 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-* and line-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.

Comment thread build-tools/utils/__tests__/token-versions.test.js Outdated
Comment thread build-tools/utils/__tests__/token-versions.test.js
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.63%. Comparing base (409fa38) to head (44e3163).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

2 participants