fix(diff): include components in token diff and remove dead import - #51
Merged
davideast merged 1 commit intoMay 2, 2026
Merged
Conversation
The diff command compared colors, typography, rounded, and spacing but silently skipped components — changes to button styles, added/removed component tokens, etc. were invisible in the output. - Add `components` field to the tokens diff using a local serializer that flattens ComponentDef.properties Maps into plain objects before passing them to the existing diffMaps utility - Remove the unused `serializeDesignSystem` import - Add diff.test.ts with 4 cases: no-change, added, removed, modified
davideast
approved these changes
May 2, 2026
Collaborator
|
Thank you so much @Saatvik-GT! |
Contributor
Author
Glad it landed! Happy to contribute more :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #50
The
diffcommand compared colors, typography, rounded, and spacing tokensbetween two DESIGN.md files, but silently skipped components entirely. Any
change to a component — added, removed, or modified properties like
backgroundColororpadding— produced no output in the diff. There wasalso a dead
serializeDesignSystemimport that was never called.Root Cause
In
commands/diff.ts, thetokensobject is built by passing eachDesignSystemStatemap throughdiffMaps. Thecomponentsmap was simplynever included.
ComponentDefstores its properties in a nestedMap, whichJSON.stringifyserializes as{}, so it could not be passed todiffMapsdirectly without first being flattened.
Fix
Added a
serializeComponentshelper that convertsMap<string, ComponentDef>into
Map<string, Record<string, unknown>>by flattening each component'sproperties via
Object.fromEntries. The result is passed to the existingdiffMapsutility, consistent with how all other token groups are diffed.Also removed the unused
serializeDesignSystemimport.Tests
Added
diff.test.ts(previously did not exist) with 4 cases:addedremovedmodifiedAll 207 tests pass.