Skip to content

feat(codemod): add props unification functions - #87

Open
LinKCoding wants to merge 4 commits into
kl-gmt-1872-props-unification-sizefrom
kl-gmt-1873-props-unifications-codemod
Open

LinKCoding wants to merge 4 commits into
kl-gmt-1872-props-unification-sizefrom
kl-gmt-1873-props-unifications-codemod

Conversation

@LinKCoding

@LinKCoding LinKCoding commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Adds a size-and-alignment preset to @skillsoft/gamut-codemods that moves consumer code onto the new size and alignment values, and makes ProgressBar's variant prop optional.

  • prop-values migration: renames Select's sizeVariant to size (small → sm, base → md) and converts size values on Button, Input, Toggle, SelectDropdown, ProgressBar, Badge, DatePicker's inputSize, FormGroup and ConnectedFormGroup labelSize, and FormGroupLabel size.
  • Alignment values: left / right become start / end for iconPosition, buttonPlacement, alignContentContainer, openFrom, menuAlignment, Popover align and beak, Coachmark beak, and GridForm layout. Tip and PopoverContainer alignment values like top-left map to their start / end forms.
  • Only components imported from @skillsoft/gamut are rewritten, so aliased imports work and local components with the same name are left alone.
  • Non-literal values for a prop that has values to convert get a warning instead of a rewrite.
  • The mapping lives in src/presets/size-and-alignment/manifest.ts, typed by ComponentPropChanges in src/lib/manifest.ts. run-source.ts and transform.test.ts pick up the preset.
  • Fixtures cover alignment, sizes, Select rename, scoped imports, and dynamic values with warnings.
  • README documents the preset, what it changes, and the values it doesn't cover (object-literal values, Text textAlign, GridForm field position, props read from variables).
  • gamut: ProgressBar variant is optional and defaults to default.

PR Checklist

  • Related to designs:
  • Related to JIRA ticket: GMT-1873
  • Changeset added (or empty changeset if no release)
  • I have run this code to verify it works
  • This PR includes unit tests for the code change
  • This PR includes testing instructions tests for the code change
  • Package previews from this PR are passing end-to-end tests in all relevant consuming repositories

Testing Instructions

Don't make me tap the sign.

  1. Run the codemod tests: yarn nx test gamut-codemods. The fixture cases for prop-values should pass, and each output should be unchanged when run a second time.
  2. Preview the preset on a consumer repo that imports @skillsoft/gamut: npx @skillsoft/gamut-codemods size-and-alignment . --dry. Confirm the diff renames sizeVariant to size and maps small / base and left / right as the README describes.
  3. Run it for real in a clean working tree, then check the warnings for any non-literal values that need a manual fix.
  4. ProgressBar: check Status/ProgressBar in Storybook and the ProgressBar docs. Confirm <ProgressBar percent={50} /> renders with the default variant and no variant prop is required.
  5. Pages to check after running the codemod on a consumer app: Input, Select, SelectDropdown, Toggle, Buttons, DatePicker, ProgressBar, Badge, Popover, Coachmark, and GridForm.

PR Links and Envs

Repository PR Link
Monolith Monolith PR

🤖 Generated with Claude Code

LinKCoding and others added 2 commits November 17, 2026 16:58
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Renames Select sizeVariant to size and converts size values to sm/md/lg
and left/right alignment values to start/end on Gamut components, scoped
to components imported from @skillsoft/gamut.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@LinKCoding LinKCoding changed the title Kl gmt 1873 props unifications codemod feat(codemod): add props unification functions Nov 18, 2026
…clarations

size-and-alignment now converts string literals in either branch of a
ternary, and rewrites the string-literal union and literal default of a
prop type when the file passes that prop to a Gamut component.

Warnings for values that can't be converted name where the value is
declared, and the CLI prints them grouped by file.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@LinKCoding
LinKCoding added this pull request to stack #95 November 20, 2026 21:20
@LinKCoding
LinKCoding marked this pull request as ready for review November 20, 2026 21:20
@LinKCoding
LinKCoding requested a review from a team as a code owner November 20, 2026 21:20
@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@skillsoft/eslint-plugin-gamut

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/eslint-plugin-gamut@87
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/eslint-plugin-gamut@87.tgz

@skillsoft/gamut

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut@87
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut@87.tgz

@skillsoft/gamut-agent-tools

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-agent-tools@87
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-agent-tools@87.tgz

@skillsoft/gamut-codemods

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-codemods@87
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-codemods@87.tgz

@skillsoft/gamut-icons

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-icons@87
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-icons@87.tgz

@skillsoft/gamut-illustrations

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-illustrations@87
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-illustrations@87.tgz

@skillsoft/gamut-patterns

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-patterns@87
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-patterns@87.tgz

@skillsoft/gamut-styles

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-styles@87
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-styles@87.tgz

@skillsoft/gamut-tests

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-tests@87
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-tests@87.tgz

@skillsoft/variance

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/variance@87
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/variance@87.tgz

commit: 849f3bb

@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.92285% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.44%. Comparing base (9440925) to head (849f3bb).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...gamut-codemods/src/migrations/prop-values/index.ts 96.31% 7 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                           @@
##           kl-gmt-1872-props-unification-size      #87      +/-   ##
======================================================================
+ Coverage                               77.23%   77.44%   +0.20%     
======================================================================
  Files                                     464      467       +3     
  Lines                                   32083    32417     +334     
  Branches                                 1467     1597     +130     
======================================================================
+ Hits                                    24778    25104     +326     
- Misses                                   7304     7306       +2     
- Partials                                    1        7       +6     
Flag Coverage Δ
pull-request 77.44% <97.92%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ops-unifications-codemod

Keep variant="blue" in the ProgressBar sizes fixture output. ProgressBar defaults to the 'default' variant, so the codemod must not drop an explicit variant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant