Open-source framework/library builders! Follow this guide to add your codemods to the Codemod Registry. Once added, they will automatically integrate with Intuita's platform. This simplifies codemod discovery and distribution, and offers a great developer experience for running codemods.
Thanks to features like codemod deep links and codemod engines that are powered up by Intuita under the hood via its IDE extensions and CLI, your users can go from migration docs to having their code automatically transformed with just one click!
Importing codemods into the public registry
To ensure quality and usefulness of codemods and code automation recipes, Intuita provides guidelines and sets some basic governance rules. We'll also be building features to empower the community to uprank the highest quality codemods and recipes. Here is the process to add your codemods to the registry.
- Adding existing/new codemods to the registry
Understanding the registry's structure
The codemod registry consists of many codemods running over various codemod engines (jscodeshift, ts-morph, Uber's Piranha, and Intuita's File Transformation Engine).
The codemod registry contains directories for each framework/library. Within each directory, you can find the supported framework/library versions. For each version, you can find all the supported codemods.
Codemod registry structure:
├── next/ ----> Framework/Library
│ └── 13/ ---> Framework/Library Version
│ ├── app-directory-boilerplate/ --> Codemod
│ │ ├── README.md -> Readme
│ │ ├── config.json -> Metadata
│ │ ├── index.ts -> Transform file
│ │ └── test.ts -> Test cases
│ └── ...
│ └── 0/
│ ├── add-deprecation-comment
│ ├── nest-from-js
│ └── ...
│ └── ...
You can contribute to the registry by adding a completely new framework/library including supported codemods, or you can add a codemod to an existing framework/library.
Opening a PR with your codemod
To contribute your codemod to the registry, you can open a PR containing your codemod. Your codemod should meet the following criteria:
Includes a Readme file that contains:
Before and after code examples.
Applicability criteria (applicable framework/library versions, etc.)
Change mode (Assistive/autonomous).
Used codemod engine (jscodeshift, ts-morph, Uber Piranha, Intuita File transformation Engine).
Estimated time saving per occurrence.
Links for more info (any links to manual/codemod migration steps).tip
You can use the codemod Readme template here →
config.jsonmetadata file which indicates the following fields:
"language": "[java/ts/tsx]", (Optional - Only if engine is Piranha)
"dependencyVersionLowerThan": ["[framework]", "[vx.x.x]"],
"owner": "[codemod owner name]"
Example of the
replace-next-headcodemod metadata file:
"dependencyVersionLowerThan": ["next", "13.0.0"],
index.tsfile (if using jscodeshift, ts-morph, or repomod-engine) or
rules.tomlfile (if using piranha). This file should include the transform function or the Piranha rule.
test.tsfile (if using jscodeshift, ts-morph, or repomod-engine) which includes the codemod's test cases. Learn more about testing codemods here →