The SWAN Command Line Interface (CLI) is a unified tool for managing your SWAN package directly from your codebase using the command line.
CLI
Codemods
Overview
What is a codemod?
A codemod is a powerful script that replaces the need for manually performing code changes. To make both major and minor upgrades easier, we offer codemods to automate as many of the manual code changes as possible.
When do I run codemods?
Technically, you are only required to make code changes when migrating to a major release, because a minor release will never introduce a breaking change that involves code changes.
However, we encourage you to run codemods during minor migrations, too! This is because we often deprecate features in minor releases to prepare for their removal in the next major release. By addressing these deprecations in your minor migrations, you’re setting yourself up for a much easier major migration later!
Which codemods do I run?
The codemods released with major versions are breaking - they can safely run only once. Run them ONLY when migrating from the previous major version.
The codemods released with minor versions are idempotent - they can be safely run more than once. Run them when your codebase is greater than or equal to its version, and less than the next major.
How to run codemods
Installation
To run the codemods, you will use the SWAN CLI, a unified tool for managing your SWAN package directly from your codebase using the command line.
The SWAN CLI is an NPX tool, so there is no need to install the package or its dependencies. However, it is required that you run the CLI using Node 18+.
Usage
You can simply run npx @vp/swan-cli@latest [command] [options]
from the root of your codebase to invoke the latest and greatest version of the tool. Replace [command]
and [options]
with any of the flags below to customize your experience.
Commands
--run
Runs the codemod CLI, allowing you to select the directory to execute against, and which codemods to execute.
npx @vp/swan-cli@latest run
Options (optional):
--from
The minimum version, inclusive, to include in the preselection of codemods to execute. Codemods matching the from
version will be run.
npx @vp/swan-cli@latest run --from=1.0.0
--to
The maximum version, exclusive, to include in the preselection of codemods to execute. Codemods matching the to
version will not be run.
npx @vp/swan-cli@latest run --to=3.0.0
npx @vp/swan-cli@latest run --from=2.0.0 --to=3.0.0
--list
Lists the codemods without executing them.
npx @vp/swan-cli@latest run --list
Respects the `--from` and `--to` flag for displaying matching codemods.
npx @vp/swan-cli@latest run --list --from=2.0.0 --to=3.0.0
--verbose
When used with the `run` command, logs information about each file the transformations were run against.
npx @vp/swan-cli@latest run --verbose
When used with the `--list` option, logs all the transformations to be executed by the codemod.
npx @vp/swan-cli@latest run --list --verbose
--help, -h
When used with a command, displays help for that command.
npx @vp/swan-cli@latest run --help
When used on its own, lists available commands.
npx @vp/swan-cli@latest --help
Next steps
Once the codemods are done executing, you will see the results printed to your terminal along with some disclaimers and next steps.

An example of the CLI terminal output including results, disclaimers, and next steps.
Review the disclaimers
The codemods may not fix everything that is currently deprecated. For changes that cannot be automated with a codemod, you will find migration instructions in the next major release migration guide. For changes that can be partially automated with a codemod, you will find additional effort or review instructions listed in the "Disclaimers" section of the output. Note that disclaimers are logged for all codemods that were executed, even if they didn't transform any of your files.
Run your formatter
Be sure to run your own formatter (i.e. prettier, eslint). The codemod library we use will apply its own formatting against your transformed files, and they will be ugly 🙂
Verify the changes
Verify that the changes made by the codemods are accurate, extensive, and produced zero regressions by running your test suite, booting up your application, performing visual QA, and spot-checking the diff. Keep in mind that the codemod library cannot anticipate every use case, so look closely for things it may have missed!
List of codemods
Here is an up-to-date list of all available codemods and their disclaimers, grouped by their minimum compatible SWAN version.
3.14.0
- Replace
ComboboxWithFloatingLabel
,DropdownWithFloatingLabel
,ListboxWithFloatingLabel
andTextInputWithFloatingLabel
(and their types, sub-components and their types) withInputWithFloatingLabel
(and sub-component and type).- ⚠️ Codemod will not include the
fullWith
prop if it already exists on theDropdown
orListbox
component with a different value than the prop onDropdownWithFloatingLabel
orListboxWithFloatingLabel
. Please migrate it manually
- ⚠️ Codemod will not include the
- Remove
gridGuttersVariant
prop fromCarousel
component. - Remove
gutter
prop fromGridContainer
component.
3.10.1
- Rename
visuallyHiddenLabel
prop toaccessibleText
forAlertBoxDismissButton
component- ⚠️ This codemod renames
visuallyHiddenLabel
toaccessibleText
but retains the existing value, so if you used a React node, you'll need to update it to a string afterwards.
- ⚠️ This codemod renames
- Rename
visuallyHiddenLabel
prop toaccessibleText
forModalDialogCloseButton
component- ⚠️ This codemod renames
visuallyHiddenLabel
toaccessibleText
but retains the existing value, so if you used a React node, you'll need to update it to a string afterwards.
- ⚠️ This codemod renames
- Rename
visuallyHiddenLabel
prop toaccessibleText
forZoomControlsIn
andZoomControlsOut
components- ⚠️ This codemod renames
visuallyHiddenLabel
toaccessibleText
but retains the existing value, so if you used a React node, you'll need to update it to a string afterwards.
- ⚠️ This codemod renames
- Rename
visuallyHiddenLabel
prop toaccessibleText
forZoomControlsValue
component- ⚠️ This codemod renames
visuallyHiddenLabel
toaccessibleText
but retains the existing value, so if you used a React node, you'll need to update it to a string afterwards.
- ⚠️ This codemod renames
3.8.0
- Remove
skin
prop fromFormLabel
component - Remove
skin
prop fromStandardForm
component
3.7.0
- Move
imageFocalPoint
prop fromBanner
toBannerImage
component- ⚠️ Codemod will not run if the
imageFocalPoint
prop already exists on theBannerImage
component with a different value than the prop onBanner
. Please migrate it manually.
- ⚠️ Codemod will not run if the
3.5.0
- Remove style keys
button
,fieldSet
,icon
,pricing
3.3.0
- Remove
size
prop from theButton
component - Remove
size
prop fromCallout
component - Remove
size
prop fromDropdown
component - Remove
size
prop fromListbox
component - Remove
size
prop fromTextInput
component - Remove
size
prop fromToggleSwitch
component - Rename
iconType
prop values forIcon
component (closeLarge
->close
,closeSmall
->close
,toggleOff
->cross
,plusRounded
->add
,satisfaction
->guaranteedSatisfaction
,caretRight
->chevronRight
,login
->arrowRight
,uploadYourArtwork
->upload
,searchLarge
->search
,clock
->orderHistory
,myProjects_1
->myProjects
,polish
->sparkle
,deleteStudio
->delete
,playRounded
->play
,chatReview
->liveChat
,phoneCall
->phone
,help
->phone
,checkRoundedEdges
->check
,checkRoundedEdgesMini
->check
,heartEmpty
->heart
,heartFilled
->heart
,starEmpty
->star
,starFilled
->star
) - Rename
size
prop values forIcon
component (10p
->16p
,28p
->standard
,32p
->standard
,40p
->standard
,48p
->standard
,60p
->standard
) - Rename
swan-icon-size-1em, swan-icon-size-1rem
classes toswan-icon-size-standard
- Rename
size
prop values forSpinner
component (mini -> standard, tiny -> standard) - Remove
wrapHeaders
prop fromTabs
component - Rename
skin
prop values forCallout
component (foil -> info, new/announcement -> accent, discount -> promo, standard -> info) - Remove
border
prop fromCallout
component - Replace
variant="overlay"
prop withemphasis="low"
and removevariant
prop fromCallout
component - Rename
skin
prop value fromline
tostandard
forDropdown
component - Remove
width
prop fromAlertBox
component - Rename
skin
prop values forAlertBox
component (standard -> info, positive -> success) - Remove
textHorizontalAlignOnExtraSmall
prop fromBanner
component - Rename
iconType
prop value fromemail
tomail
forIcon
component
3.0.0
- Migrate
margin*/m*
,padding*/p*
prop values (1
->2
,2
->3
,3
->4
,4
->5
,5
->6
,6
->7
,13
->12
)- ⚠️ This codemod can only be run ONCE to migrate space props from SWAN v2 to v3.
- Migrate
fontFamily
prop values (graphik
->primary
,secondary
->primary
,special
->secondary
) - Migrate import paths for mixins to
@vp/swan/mixins/*
- Remove
skin
prop fromThumbnailsHero
component - Rename prop names for
Typography
component (align
->textAlign
,weight
->fontWeight
) - Rename constants and import paths for tokens (
dtcgTokens
->tokens
) - Remove style keys (
controlIcon
,detailsBanner
,embeddedTextHero
,promoBar
,secondaryTile
,standardBanner
,standardHero
,combobox
,menu
,legacy*
) - Remove
skin
prop fromTable
component - Rename type
StyleSpacing0to13
toStyleSpaceWithAuto
2.22.0
- Rename
fontWeight
prop value frombolder
tobold
MigratefontSize
prop values (-1
-6
,m*
,x*
,xm*
->xsmall
-x4large
)Migratecolor
design tokens to the SWAN v3 token architecture- ⚠️ This codemod does not work on bracket object notation or with destructured values
- ⚠️ This codemod will not change tokens used as an SCSS mixin or SCSS function
- ⚠️ This codemod will only replace tokens with a direct replacement. For all other tokens, refer to https://vista.design/swan/foundations/all-tokens/ and work with your designer to find a suitable replacement.
- Migrate
font
design tokens to the SWAN v3 token architecture- ⚠️ This codemod does not work on bracket object notation or with destructured values
- ⚠️ This codemod will not change tokens used as an SCSS mixin or SCSS function
- ⚠️ This codemod will only replace tokens with a direct replacement. For all other tokens, refer to https://vista.design/swan/foundations/all-tokens/ and work with your designer to find a suitable replacement.
- Migrate
component
design tokens to the SWAN v3 token architecture- ⚠️ This codemod does not work on bracket object notation or with destructured values
- ⚠️ This codemod will not change tokens used as an SCSS mixin or SCSS function
- ⚠️ This codemod will only replace tokens with a direct replacement. For all other tokens, refer to https://vista.design/swan/foundations/all-tokens/ and work with your designer to find a suitable replacement.
- Migrate
element
design tokens to the SWAN v3 token architecture- ⚠️ This codemod does not work on bracket object notation or with destructured values
- ⚠️ This codemod will not change tokens used as an SCSS mixin or SCSS function
- ⚠️ This codemod will only replace tokens with a direct replacement. For all other tokens, refer to https://vista.design/swan/foundations/all-tokens/ and work with your designer to find a suitable replacement.
- Migrate
size
design tokens to the SWAN v3 token architecture- ⚠️ This codemod does not work on bracket object notation or with destructured values
- ⚠️ This codemod will not change tokens used as an SCSS mixin or SCSS function
- ⚠️ This codemod will only replace tokens with a direct replacement. For all other tokens, refer to https://vista.design/swan/foundations/all-tokens/ and work with your designer to find a suitable replacement.
- Migrate
state
design tokens (selected/disabled) to the SWAN v3 token architecture- ⚠️ This codemod does not work on bracket object notation or with destructured values
- ⚠️ This codemod will not change tokens used as an SCSS mixin or SCSS function
- ⚠️ This codemod will only replace tokens with a direct replacement. For all other tokens, refer to https://vista.design/swan/foundations/all-tokens/ and work with your designer to find a suitable replacement.
- Migrate
base
design tokens to the SWAN v3 token architecture- ⚠️ This codemod does not work on bracket object notation or with destructured values
- ⚠️ This codemod will not change tokens used as an SCSS mixin or SCSS function
- ⚠️ This codemod will only replace tokens with a direct replacement. For all other tokens, refer to https://vista.design/swan/foundations/all-tokens/ and work with your designer to find a suitable replacement.
- Migrate
shadow
design tokens to the SWAN v3 token architecture- ⚠️ This codemod does not work on bracket object notation or with destructured values
- ⚠️ This codemod will not change tokens used as an SCSS mixin or SCSS function
- ⚠️ This codemod will only replace tokens with a direct replacement. For all other tokens, refer to https://vista.design/swan/foundations/all-tokens/ and work with your designer to find a suitable replacement.
- Migrate
spacing
design tokens to the SWAN v3 token architecture- ⚠️ This codemod does not work on bracket object notation or with destructured values
- ⚠️ This codemod will not change tokens used as an SCSS mixin or SCSS function
- ⚠️ This codemod will only replace tokens with a direct replacement. For all other tokens, refer to https://vista.design/swan/foundations/all-tokens/ and work with your designer to find a suitable replacement.
- Migrate
media query (mq)
design tokens to the SWAN v3 token architecture- ⚠️ This codemod does not work on bracket object notation or with destructured values
- ⚠️ This codemod will not change tokens used as an SCSS mixin or SCSS function
- ⚠️ This codemod will only replace tokens with a direct replacement. For all other tokens, refer to https://vista.design/swan/foundations/all-tokens/ and work with your designer to find a suitable replacement.
- Rename
textColor
prop values (alert
->error
,black
,black-800
->standard
,dark-grey
,dark-gray
,grey-700
,gray-700
->subtle
) - Remove
starsToShow
prop fromRatingsStars
component
2.21.0
- Rename
lightMode
prop value and CSS class tostandardMode
- Replace
backgroundColor="loading-shimmer"
prop withloadingShimmer
- Migrate
backgroundColor
/bgc
prop values (discount
->promo
,grey/gray-*
,platinum
,light-grey
/gray
->strong
,black-900
->black
,white-900
/white
->standard
,dark-blue
,atlantic
,kingfisher
->accent
)
2.20.0
- Migrate constant
GLOBAL_FONT
to new color token - Migrate
SEMANTIC_COLORS
properties to new color tokens- ⚠️ If you have used
SEMANTIC_COLORS.selected
, you may need to changeSwanSemColorBgSelected
toSwanSemColorBorderSelected
.
- ⚠️ If you have used
- Migrate
SOURCE_COLORS
properties to new color tokens
2.17.0
- Remove
contentWidth
prop fromThumbnailsHero
component - Remove
imageShadow
prop fromStandardTile
component - Remove
skin="brand-blue"
prop fromIcon
component - Remove
size
prop fromFormError
,FormHelper
,FormLabel
components - Rename
skin
prop value fromaccent
toprimary
forButton
component - Rename component from
ButtonSuperBreak
tobr
- Replace component
Icon*
with<Icon iconType="*">
- Remove
skin="peek"
prop fromAccordion
component - Replace component
StandardSection
withBox
- Rename
skin
prop value fromcomparison
todividers
forTable
component - Rename
skin
prop value fromsimple
todividers
forTable
component
2.13.0
- Remove
borderless
prop fromDropdown
component - Remove
fixedWidthHeaders
,size
props fromTabs
component - Remove
fullWidthHeader
prop fromTabs
component - Remove
skin="link"
prop fromListbox
,BasicListbox
componentsRemoverich
,richLastAlign
props fromCollapsibleSummary
component - Remove
size="large"
prop fromAccordion
component - Remove
size="mega"
prop fromTextInput
component - Remove
size="super"
prop fromCallout
component - Rename
'progressIndicator
prop value fromfraction
tonone
forCarousel
component - Rename prop values and components for
Icon
component (shoppingBag_x
->shoppingBag_0
,IconShoppingBag_x
->IconShoppingBag_0
,redLegacy
->redo
,IconRedoLegacy
->IconRedo
,undoLegacy
->undo
,IconUndoLegacy
->Undo
) - Rename
srOnly
prop tovisuallyHidden
Renameskin
prop value fromgallery
toproduct
forStandardTile
component - Migrate
textSize
prop tofontSize
(1
->x4
,2
->x3
,3
->x2
,4
->x1
,5
->x
,6
->xm1
,7
->xm2
) - Rename
skin
prop value fromstandard
tounder
forThumbnailsHero
component
2.5.0
- Remove
rounded
prop fromDropdown
component - Rename
textColor
prop values (alert
->error
,black
->black-800
,dark-grey
/gray
->grey-700
) - Rename
textColor
prop value fromblack-900
toblack-800
2.0.0
- Rename color constants (
colors
->SEMANTIC_COLORS
,sourceColors
->SOURCE_COLORS
) - Rename constant from
globalFont
toGLOBAL_FONT
- Rename component from
LegacyModalDialog
toModalDialog
- ⚠️ Visual QA recommended, especially if you had any snowflakes on your
LegacyModalDialog
. - ⚠️ If you have added a
backgroundColor
orbgc
prop ontoLegacyModalDialogContent
, you will need to manually move that prop toModalDialog
now.
- ⚠️ Visual QA recommended, especially if you had any snowflakes on your
- Rename component from
LegacyPopover
toPopover
- ⚠️ Visual QA recommended, especially if you had any snowflakes on your
LegacyPopover
.
- ⚠️ Visual QA recommended, especially if you had any snowflakes on your
- Rename marketing constants (
marketingBackgroundTokenMapping
->MARKETING_BACKGROUNDS
,marketingBackgroundColors
->MARKETING_COLORS
) - Rename component from
Paginator
toPagination
- Rename component from
PipeDivider
toPipeSeparator
- Rename screen class constants (
screenClasses
->SCREEN_CLASSES
,screenClassMax
/MinWidths
->SCREEN_CLASS_MAX/MIN_WIDTHS
) - Rename component from
SecondaryTileBadges
toSecondaryTileCallouts
- Rename spacing constants (
spacing
->SPACING
,spacingPx
->SPACING_PX
) - Rename component from
TableTextSecondLine
toTableTextNewLine
RenametextAlign
prop totextHorizontalAlign
- Rename component from
TextButton
toButton
- Rename
widthVariant
prop towidth
Removeskin
prop fromCollapsible
component - Rename
allCaps
prop totextAllCaps
- Replace component
BasicPreloader
withSpinner
- ⚠️ Add the new "
spinner
" style key - ⚠️ Add the required ARIA attributes for a11y support, you can find guidelines in the docs: https://vista.design/swan/components/spinner/?tab=Usage#Accessibility
- ⚠️ If you are using
Preloader
(instead ofBasicPreloader
), replace it manually
- ⚠️ Add the new "
- Rename
cardDividers
prop todividers
forGridContainer
component - Rename
sizeVariant
prop tosize
- Rename
visuallyHiddenText
prop toaccessibleText
- Replace component
ControlIcon
withIcon
- Replace
minimal
prop withskin="minimal"
inList
,Ul
components
How does Cli meet your needs?