|
2 | 2 | <img src=".github/assets/migrations-template.png" alt="<ECOSYSTEM_NAME> Codemods" /> |
3 | 3 | </div> |
4 | 4 |
|
5 | | -This repository serves as a template for open-source migrations, allowing contributors & framework maintainers to quickly whip up a repository for codemods that resolve breaking changes, refactors, and more. |
6 | | - |
7 | | -This template repository comes pre-configured with a GitHub workflow that automatically publishes the latest version of your codemods, keeping them up-to-date on [Codemod Registry](https://app.codemod.com/registry). |
8 | | - |
9 | | -> **Initial setup guide (remove once the repo is customized)** |
10 | | -> |
11 | | -> 1. Search and replace placeholders: |
12 | | -> - `<ECOSYSTEM_NAME>` (e.g., "React", "Node.js", "AcmeLib") |
13 | | -> - `@<NAMESPACE>` (e.g., `acme`) |
14 | | -> - `<MAJOR_VERSION>` (e.g., `v5`) |
15 | | -> 2. Scaffold new codemods under `recipes` and name them like `@<NAMESPACE>/<MAJOR_VERSION> (optional)/<codemod-name>`: |
16 | | -> |
17 | | -> ```bash |
18 | | -> npx codemod@latest init recipes/my-codemod |
19 | | -> ``` |
20 | | -> |
21 | | -> 3. Build codemod manually or with **[Codemod Studio](https://app.codemod.com/studio) (recommended)** ([Read docs →](https://go.codemod.com/studio-docs)). |
22 | | -> 4. Validate and test: |
23 | | -> |
24 | | -> ```bash |
25 | | -> npm run validate |
26 | | -> npm run test |
27 | | -> ``` |
28 | | -> |
29 | | -> 5. Commit hooks and CI run lint, validate, typecheck, and tests. |
30 | | -> |
31 | | -> 6. Set up auto-publishing to [Codemod Registry](https://app.codemod.com/registry): |
32 | | -> |
33 | | -> 1. **Get API key**: [https://app.codemod.com/api-keys](https://app.codemod.com/api-keys) |
34 | | -> 2. **Create GitHub Environment**: Repository Settings → Environments → New environment (name it `production`) |
35 | | -> 3. **Add secret**: `CODEMOD_API_KEY` with your API key |
36 | | -> 4. **Optional variables**: `CODEMOD_REGISTRY_SCOPE`, `CODEMOD_REGISTRY_URL` |
37 | | -> |
38 | | -> This automatically publishes codemods when you merge changes to `main`. See [AUTO_PUBLISH_SETUP.md](./AUTO_PUBLISH_SETUP.md) for details. |
39 | | -
|
40 | | -
|
41 | | -## Overview |
42 | | -
|
43 | | -This repository contains codemods (automated migrations) for <ECOSYSTEM_NAME>. These codemods facilitate adopting new features and upgrading across breaking changes. |
44 | | -
|
45 | | -Codemods, public or private, are preferred to reside in repositories owned by the main organization of their respective projects. This repository serves as a template for codemod packages, allowing contributors to quickly create a repository for their published codemods. |
46 | | -
|
47 | | -This template repository comes pre-configured with a GitHub workflow that automatically publishes the latest version of your codemod, eliminating the need to manually publish codemods after making updates. |
| 5 | +> **Remove this section once the repo is customized** |
| 6 | +> Framework/SDK maintainers: This template comes with setup guides, utilities, and a GitHub Action to help you and your community build and publish codemods with ease. Once you, the repo maintainers, approve codemod PRs, they’ll be automatically published as official codemods to the [Codemod Registry](https://app.codemod.com/registry) under your org scope. Check out the [Node.js codemods](https://codemod.link/nodejs-official) for an example. See [AUTO_PUBLISH_SETUP.md](.github/AUTO_PUBLISH_SETUP.md) for setup instructions. |
| 7 | +
|
| 8 | +This repository contains codemods for <FRAMEWORK_OR_SDK_NAME>. These codemods facilitate adopting new features and upgrading across breaking changes. |
| 9 | + |
48 | 10 |
|
49 | 11 | ## Running Codemods |
50 | 12 |
|
|
0 commit comments