Skip to content

Commit

Permalink
Documentation edits made through Mintlify web editor
Browse files Browse the repository at this point in the history
  • Loading branch information
mintlify[bot] authored Dec 18, 2024
1 parent a1a9965 commit 89f16e2
Showing 1 changed file with 42 additions and 32 deletions.
74 changes: 42 additions & 32 deletions apps/docs/sharing/publishing-codemods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ title: Publishing to Codemod Registry
sidebarTitle: Publishing codemods
---

This guide will walk you through the steps needed to publish codemods to [Codemod Registry](/codemod-registry).
This guide will walk you through the steps needed to publish codemods to [Codemod Registry](/codemod-registry).

There are three ways to publish codemods to Codemod Registry:

1. [publishing a codemod package](#option-1-publishing-a-codemod-compatible-package-recommended)

2. [publishing from source file](#option-2-publishing-a-codemod-from-source-file)

3. [publishing with Codemod Studio](#option-3-publishing-with-codemod-studio)

<Tip>
Publishing codemods to the registry is especially useful for framework/library builders. With features like shareable codemod deep links and Codemod CLI, your users can adopt your latest releases with one click, straight from your migration doc. <Tooltip tip="MSW V2 migration">[See example ->](https://mswjs.io/docs/migrations/1.x-to-2.x/#codemods)</Tooltip>
Publishing codemods to the registry is especially useful for framework/library builders. With features like shareable codemod deep links and Codemod CLI, your users can adopt your latest releases with one click, straight from your migration doc. <Tooltip tip="MSW V2 migration">[See example ->](https://mswjs.io/docs/migrations/1.x-to-2.x/#codemods)</Tooltip>
</Tip>

## Publishing codemods
Expand All @@ -21,34 +24,40 @@ Publishing codemods to the registry is especially useful for framework/library b
Creating and publishing a [Codemod-compatible package](/building-codemods/package-requirements) brings an enhanced codemod running experience.

<Steps>
<Step title="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](/building-codemods/build-package).
</Step>
<Step title="Login to Codemod platform">
If you are not already logged in, login to Codemod platform using:
```bash
codemod login
```
</Step>
<Step title="Publish codemod">
Move to your codemod package directory and run:
```bash
codemod publish
```
</Step>
<Step title="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](/building-codemods/build-package).
</Step>

<Step title="Login to Codemod platform">
If you are not already logged in, login to Codemod platform using:

```bash
codemod login
```
</Step>

<Step title="Publish codemod">
Move to your codemod package directory and run:

```bash
codemod publish
```
</Step>
</Steps>

### Option 2: Publishing a codemod from source file

<Steps>
<Step title="Login to Codemod platform">
If you are not already logged in, login to Codemod platform using:
```bash
codemod login
```
</Step>
<Step title="Publish codemod">
Publish the codemod from source path:
<Step title="Login to Codemod platform">
If you are not already logged in, login to Codemod platform using:

```bash
codemod login
```
</Step>

<Step title="Publish codemod">
Publish the codemod from source by specifying the path to the transform file:

<Note>
To generate a [Codemod-compatible package](/building-codemods/package-requirements), Codemod CLI will ask you a few questions about your codemod to generate the [`codemodrc.json` configuration file](/building-codemods/package-requirements#codemodrc-json-reference) automatically for you.
Expand All @@ -59,7 +68,13 @@ Creating and publishing a [Codemod-compatible package](/building-codemods/packag
```bash
codemod publish [path] --source
```
</Step>

**Example:**

```bash
codemod publish src/index.ts --source
```
</Step>
</Steps>

### Option 3: Publishing with Codemod Studio
Expand All @@ -70,12 +85,7 @@ To do so, you can click `Run with CLI`. After publishing the codemod, you will b

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.

<video
autoPlay
loop
className="w-full aspect-video"
src="/images/codemod-studio/studio-publish.mp4"
></video>
<video autoPlay loop className="w-full aspect-video" src="/images/codemod-studio/studio-publish.mp4" />

## Unpublishing codemods

Expand Down

0 comments on commit 89f16e2

Please sign in to comment.