Thanks for your interest in contributing to useful-codemods!
# Install dependencies
pnpm install
# Run all tests
pnpm test
# Type-check all codemods
pnpm check-types- Create a branch from
main. - Make your changes and add or update tests.
- Run
pnpm testandpnpm check-typesto verify everything passes. - Add a changeset (see below).
- Open a pull request.
This repo uses Changesets for versioning and releases. Every PR that changes a codemod must include a changeset.
pnpm changesetFollow the prompts to:
- Select the affected codemod(s).
- Choose the semver bump type — patch for bug fixes, minor for new features, major for breaking changes.
- Write a short summary of the change.
This creates a markdown file in .changeset/ that should be committed with your PR.
- Merge a PR with one or more changesets into
main. - CI automatically opens a Version Packages PR that bumps versions in
package.jsonandcodemod.yaml. - Merge the version PR — git tags are created and the updated codemods are published to the Codemod registry.
Each codemod lives in its own directory under codemods/:
codemods/<name>/
scripts/codemod.ts # Codemod logic (jssg / ast-grep)
tests/ # Input/expected test fixtures
codemod.yaml # Codemod manifest
workflow.yaml # Execution workflow
package.json
Use an existing codemod like debarrel as a reference when creating a new one.