Skip to content

chore: refactor tokenSets constants#4752

Merged
mimarz merged 8 commits intomainfrom
chore-cli-tokenset-constants
Apr 27, 2026
Merged

chore: refactor tokenSets constants#4752
mimarz merged 8 commits intomainfrom
chore-cli-tokenset-constants

Conversation

@mimarz
Copy link
Copy Markdown
Collaborator

@mimarz mimarz commented Apr 17, 2026

Waiting for #4763 to have tests for this refactor.

This is a small refactor to reduce duplicate constants, faster execution and cleaner separation of concern.

This was originally done in #4639, but since we putting that on hold I have extracted those improvements into here.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 17, 2026

🦋 Changeset detected

Latest commit: db97bea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

Preview deployments for this pull request:

storybook - 27. Apr 2026 - 09:17

@mimarz mimarz changed the title Chore cli tokenset constants chore: refactor tokenSets constants Apr 17, 2026
@mimarz mimarz marked this pull request as draft April 17, 2026 18:23
@mimarz mimarz requested a review from Copilot April 21, 2026 08:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors token creation/formatting to centralize token set “dimensions” (color schemes + size modes) and reduce duplicated constants across CLI token generation flows.

Changes:

  • Introduces tokenSetDimensions and threads it through $themes / $metadata generators and call sites.
  • Adds colorNamesByCategory() helper and updates generators to consume precomputed color-name arrays.
  • Splits token file generation into createSystemTokenFiles() (system files) + tokenSetsToFiles() (per token set) and updates CLI/script usage.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/cli/src/tokens/utils.ts Adds colorNamesByCategory() helper for deriving color name lists.
packages/cli/src/tokens/types.ts Adds ColorNamesByCategory + TokenSetDimensions types.
packages/cli/src/tokens/format.ts Uses tokenSetDimensions and derived color-name lists when generating $themes.
packages/cli/src/tokens/create/generators/$themes.ts Updates $themes generation API to take token dimensions + color-name arrays.
packages/cli/src/tokens/create/generators/$metadata.ts Updates $metadata generation API similarly and adds doc comment.
packages/cli/src/tokens/create/files.ts Splits system token files from token set files and returns file lists.
packages/cli/src/tokens/create.ts Centralizes color schemes/size modes into tokenSetDimensions.
packages/cli/src/scripts/update-preview-tokens.ts Aligns preview token generation with new $themes API.
packages/cli/bin/designsystemet.ts Updates CLI create command to use new file generation functions and shared dimensions.
.changeset/warm-streets-clap.md Adds a new changeset file (currently empty content).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/cli/src/tokens/utils.ts Outdated
Comment thread packages/cli/src/tokens/types.ts Outdated
Comment thread .changeset/warm-streets-clap.md
@mimarz mimarz force-pushed the chore-cli-tokenset-constants branch from f4c8891 to cbc1f8b Compare April 22, 2026 10:41
@mimarz mimarz marked this pull request as ready for review April 22, 2026 10:43
mimarz and others added 8 commits April 27, 2026 09:14
@mimarz mimarz force-pushed the chore-cli-tokenset-constants branch from cbc1f8b to db97bea Compare April 27, 2026 07:14
Copy link
Copy Markdown
Collaborator

@oddvernes oddvernes left a comment

Choose a reason for hiding this comment

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

LGTM!

@mimarz mimarz merged commit 1fbb968 into main Apr 27, 2026
22 checks passed
@mimarz mimarz deleted the chore-cli-tokenset-constants branch April 27, 2026 13:39
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.

3 participants