TDS Codemod scripts. This repository contains a transform file to be used with jscodeshift to facilitate in the upgrade from the TDS v1.y.z mono-package to split packages by refactoring import statements programatically.
Usage for projects running TDS v0.34.z or earlier
It is not recommended upgrade to split packages from these versions due to the removal of global CSS and some former React components. Before using this codemod, it is recommended to upgrade to TDS 1.0.z by following the TDS v1.0.0 migration guide.
Usage for projects running TDS v1.y.z
- Node 8 or greater
- yarn or npm (Instructions assume yarn)
Clone this repository locally
Install jscodeshift CLI:
yarn global add jscodeshift
Transform your project files by running the following command, adjust paths as needed:
jscodeshift ~/path/to/your/project/ui/src/ --extensions jsx -t ./src/transform.js
Remove the former TDS package from your project:
yarn remove @telusdigital/tds
Add missing dependencies for the new split-versioned components.
Note: be sure to install components at
^1.0.0to avoid breaking changes.
To help list missing dependencies, you can run depcheck on your project's directory that contains package.json
yarn global add depcheck depcheck # copy all the @tds/core-component package names yarn add <list of TDS components>
- Restrict upgrades to install split pacakges at
^1.0.0to avoid breaking changes
- add instructions for CSS packages
- gracefully upgrade projects on TDS <= 0.34.z by skipping incompatible modules such as Grid, but upgrading others
- add or remove dependencies automatically