@alma-oss/spirit-codemods
v3.0.1
Published
Codemods scripts for Spirit Design System packages
Readme
@alma-oss/spirit-codemods
Codemods for migration to the newer version of the Spirit Design library.
spirit-codemods is a CLI tool designed to assist you in migrating to the latest version of our Spirit Design System library. This tool efficiently handles the removal of breaking changes and deprecations with simple commands.
For React transformations, it utilizes the jscodeshift library.
Install
No installation of this package is necessary; you can run it using npx.
Usage
To view the available arguments for this package, use -h or --help as shown in the example below:
npx @alma-oss/spirit-codemods -hThere are two mandatory arguments: -p/--path and -t/--transformation.
The former specifies the directory path where you want to execute transforms, while the latter specifies the desired codemod to run.
npx @alma-oss/spirit-codemods -p ./ -t v2/web-react/<codemod-name>Other optional arguments include:
-v/--version- Displays current version-h/--help- Displays this message-s/--import-sources- Additional import sources to match (comma-separated). By default, codemods match@alma-oss/spirit-web-react. Use this flag for wrapper re-export packages.-e/--extensions- Extensions of the transformed files, default:ts,tsx,js,jsx--parser- Parser to use (babel, ts, tsx, flow), default:tsx--ignore- Ignore files or directories, default:**/node_modules/**
For example, this could be the command you will run:
npx @alma-oss/spirit-codemods -p ./src -t v2/web-react/fileuploader-prop-names -e js,jsx --parser babelWhen your app imports Spirit components through a wrapper package, pass -s with the wrapper import source. Quote the value in zsh/bash so @ is not mishandled:
npx @alma-oss/spirit-codemods -p ./src -s "@org/design-system" -t v5/web-react/flex-direction-valuesEquivalent forms:
npx @alma-oss/spirit-codemods -p ./src --import-sources=@org/design-system -t v5/web-react/flex-direction-values