Codemods

Codemods are transformations that run on your codebase programmatically. This allows a large number of changes to be programmatically applied without having to manually go through every file.

Grapes provides codemod transformations to help upgrade your Grapes application when a component is updated.


Usage

In your terminal, navigate into your project and run:

npx @dev-spendesk/grapes-codemod <transform> <path>

Replacing <transform> and <path> with appropriate values.

  • transform - name of transform
  • path - files or directory to transform

Transformations

1.29.0

Migrate Avatar and HighlightIcon

This codemod changes the size prop of the Avatar and HighlightIcon components from a t-shirt size scale (e.g. 'xs', 's', 'm') to a numerical scale (e.g. 16, 24, 32).

npx @dev-spendesk/grapes-codemod size-unit "./src/**/*.{ts,js,tsx,jsx}"

0.268.0

Migrate MoneyInput

This codemod renames the component MoneyInput into AmountInput.

npx @dev-spendesk/grapes-codemod moneyinput-rename-amountinput "./src/**/*.{ts,js,tsx,jsx}"

0.266.0

Migrate FormField

This codemod renames the FormField prop infoText in infoTipContent.

npx @dev-spendesk/grapes-codemod formfield-rename-infoText "./src/**/*.{ts,js,tsx,jsx}"

0.264.0

Migrate FormField

This codemod removes the FormField prop fit.

npx @dev-spendesk/grapes-codemod formfield-remove-fit "./src/**/*.{ts,js,tsx,jsx}"