Publishing to Codemod Registry
This guide will walk you through the steps needed to publish codemods to Codemod Registry.
There are three ways to publish codemods to Codemod Registry:
Publishing codemods to the registry is especially useful for framework/library builders. With features like shareable codemod deep links and Codemod CLI & IDE extenion, your users can adopt your latest releases with one click, straight from your migration doc.
Publishing codemods
Option 1: Publishing a Codemod-compatible package (recommended)
Creating and publishing a Codemod-compatible package brings an enhanced codemod running experience.
Build a codemod package
To publish a codemod to Codemod Registry, the codemod package needs to be compatible with Codemod platform. To learn how to build Codemod-compatible codemods, please refer to the building codemods guide.
Login to Codemod platform
If you are not already logged in, login to Codemod platform using:
codemod login
Publish codemod
Move to your codemod package directory and run:
codemod publish
Option 2: Publishing a codemod from source file
Login to Codemod platform
If you are not already logged in, login to Codemod platform using:
codemod login
Publish codemod
Publish the codemod from source path:
To generate a Codemod-compatible package, Codemod CLI will ask you a few questions about your codemod to generate the codemodrc.json
configuration file automatically for you.
await
or import.meta
, you can rename it to use .mjs
or .mts
extension or specify --esm
flag to treat the source file as ESM package explicitly.codemod publish [path] --source
Option 3: Publishing with Codemod Studio
After building a codemod with Codemod Studio, you can instantly publish it to your private registry to quickly run it over your local project(s).
To do so, you can click Run with CLI
. After publishing the codemod, you will be able to run the codemod using Codemod CLI while being logged in with the same user used on Codemod Studio.
To run the codemod, you can simply copy the exported command in the pop-up modal and run the command on any local codebase of your choice.
Unpublishing codemods
To unpublish a codemod from Codemod Registry, you can use the codemod unpublish
command.
Was this page helpful?