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:

  1. publishing a codemod package
  2. publishing from source file
  3. publishing with Codemod Studio (Coming soon)

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

Creating and publishing a Codemod-compatible package brings an enhanced codemod running experience.

1

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.

2

Login to Codemod platform

If you are not already logged in, login to Codemod platform using:

codemod login
3

Publish codemod

Move to your codemod package directory and run:

codemod publish

Option 2: Publishing a codemod from source file

1

Login to Codemod platform

If you are not already logged in, login to Codemod platform using:

codemod login
2

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.

If you want to use ESM-specific features like top-level 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

Unpublishing codemods

To unpublish a codemod from Codemod Registry, you can use the codemod unpublish command.