Codemods
What are codemods?
Codemods help you upgrade Sky UI by automatically updating your code, such as renaming props or
changing imports. Install @sky-uk/ui-codemods and choose the upgrade you need.
Some changes still need manual updates. Check the release notes for anything the codemod does not cover.
Before you start
Read the Core release notes or Sections release notes for the versions you are upgrading between. Check the installed versions in your project and choose the matching upgrade path.
Save your current work so you can review the migration diff separately. Target application source
files or directories, such as ./src, rather than the whole repository. The CLI processes .js,
.jsx, .ts, and .tsx files and excludes node_modules.
Upgrade one major version at a time. For example, moving Core from v12 to v14 means completing v12-to-v13, validating that upgrade, and then completing v13-to-v14.
Installation
Install the codemods package as a development dependency using your project's package manager:
pnpm add -D @sky-uk/ui-codemods
yarn add -D @sky-uk/ui-codemods
Sky UI packages are published to Sky's Artifactory registry. If installation fails because your registry access is not configured, follow the Developer Quickstart.
Run an interactive migration
From the project directory where you installed the package, provide a source directory or file:
node ./node_modules/@sky-uk/ui-codemods/cli.js ./src
The CLI asks you to choose a package, an upgrade path, and an individual transform or
all-breaking-changes preset. It then offers a dry run, which reports the result without writing
changes. The available choices come from your installed codemods version.
Supported upgrades
Choose the upgrade that matches your project in the CLI. Available options depend on your
installed version of @sky-uk/ui-codemods.
| Upgrade | --package | --preset |
|---|---|---|
| Core v13 to v14 | ui-core | v13-to-v14/all-breaking-changes |
| Core v12 to v13 | ui-core | v12-to-v13/all-breaking-changes |
| Core v11 to v12 | ui-core | v11-to-v12/all-breaking-changes |
| Core v10 to v11 | ui-core | v10-to-v11/all-breaking-changes |
| Core v9 to v10 | ui-core | v9-to-v10/all-breaking-changes |
| Core v8 to v9 | ui-core | v8-to-v9/all-breaking-changes |
| Supported animation imports to Core | ui-core | animations-to-core/all-breaking-changes |
| Skycons v3 to v4 icon renames | skycons | v3-to-v4/refresh-to-arrowCw |
See the codemods package guide for the available transforms and CLI details.