Skip to content
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

refactor: bump style-dictionary and @tokens-studio/sd-transforms to latest #11655

Merged
merged 230 commits into from
Mar 29, 2025

Conversation

jcfranco
Copy link
Member

@jcfranco jcfranco commented Feb 28, 2025

Related Issue: #11391

Summary

This updates the design tokens build with significant restructuring changes, based on @alisonailea’s astump/style-dictionary-4.x branch. The output remains in sync with production as much as possible to prevent breaking changes.

This is the first step required before addressing additional changes proposed in #11391.

Notable changes

Source restructuring

  • Deprecates global output files in favor of semantic output
  • Splits source into:
    • config – main setup for output files
    • buildstyle-dictionary + @tokens-studio/sd-transforms configuration
    • tokens – design token JSON files (source of truth)
  • Moves tests one level higher

Test and snapshot updates

  • Tweaks spec test snapshot to make it easier to spot differences in test failures (see alternative diff and commit details)
    • Should be mainly visual or have no impact on consumable output
  • Removes non-token-related tests – these should be added once the design tokens are updated and stable

Transform and token updates

  • Configures and overrides transforms to match the existing test snapshot; these will be adjusted or removed as updates are made
  • Removes the button component token source file (unused)
  • Adds token-related entries to our custom @cspell dictionary
  • JS/Docs output types (undocumented)
    • Types now match the output (e.g., compare {semantic.color.foreground.1} source vs type)
    • No longer have strongly-typed attributes object

Test failures

There are a couple of expected spec test failures related to shadows:

  • Color values based on a token are invalid
    • Example: --calcite-shadow-0: 0 0 0 0 rgba(var(--calcite-color-neutral-blk-240), 0); – the color part is invalid syntax
  • Dimension values are no longer unitless
  • I'd like to have these reviewed before updating snapshot tests

Prep for upcoming changes

  • Adds hooks to handle upcoming design token source restructuring (e.g., splitting light/dark tokens into separate files).
  • Updates the design tokens' tsconfig.json to support next features used in build

Next steps

Coordinate with @matgalla to update build to accommodate design token updates related to #11391.

this is a non-breaking change
@jcfranco
Copy link
Member Author

jcfranco commented Mar 19, 2025

I noticed some differences in output files not covered by test snapshots:

Setting this back to draft while I sort that out.

@jcfranco jcfranco marked this pull request as draft March 19, 2025 21:05
@jcfranco jcfranco marked this pull request as ready for review March 26, 2025 20:39
@jcfranco
Copy link
Member Author

I addressed the diffs mentioned above. There are some minor differences still, but these include:

  • updated token attribute data (removals are expected and need to be handled on the doc-site side)
  • corrected names and values

I've updated the diff links for a closer check.

Copy link
Member

@benelan benelan left a comment

Choose a reason for hiding this comment

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

Nice! Code LGTM, nothing jumped out at me besides one nitpick

@jcfranco jcfranco added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Mar 29, 2025
@jcfranco jcfranco removed the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Mar 29, 2025
@jcfranco jcfranco added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Mar 29, 2025
@jcfranco jcfranco merged commit db4ff3f into dev Mar 29, 2025
14 checks passed
@jcfranco jcfranco deleted the jcfranco/11391-bump-design-tokens-tooling branch March 29, 2025 17:41
@github-actions github-actions bot added this to the 2025-04-29 - Apr Milestone milestone Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr ready for visual snapshots Adding this label will run visual snapshot testing. refactor Issues tied to code that needs to be significantly reworked.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants