@cambly/syntax-codemods
TypeScript icon, indicating that this package has built-in type declarations

0.7.0 • Public • Published

Syntax Codemods

Codemods (short for "code modifications") are tools that assist in large-scale, partially automated codebase refactors. They are especially useful for migrating codebases between different versions of a library, or migrating codebases to a different library entirely.

Example

Let's say you want to convert all instances of the color prop on <Box /> to backgroundColor:

You could write a codemod that does the following:

  1. Find all instances of <Box color="red" />
  2. Replace them with <Box backgroundColor="red" />

Before

import { Box } from "@cambly/syntax-ui";

<Box color="red" />;

After

import { Box } from "@cambly/syntax-ui";

<Box backgroundColor="red" />;

Usage

Installation

npm install --save-dev @cambly/syntax-codemods

Running a codemod

npx @cambly/syntax-codemods -c={codemod id} -p=relative/path/to/code/to/modify

Readme

Keywords

none

Package Sidebar

Install

npm i @cambly/syntax-codemods

Weekly Downloads

9

Version

0.7.0

License

Apache-2.0

Unpacked Size

84.7 kB

Total Files

28

Last publish

Collaborators

  • somethiiing
  • jpl00
  • christianv