Skip to content

An ease-of-life template repo for framework builders and codemod creators to host codemods and automate publishing to the codemod registry.

Notifications You must be signed in to change notification settings

codemod-com/codemod-template

Repository files navigation

Codemod Template

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 whip up a repository for their published codemods.

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.

Preparing repository

  1. Click Use this template.

    alt text

  2. Select Create a new repository and enter your new repository details.

  3. Login with Codemod CLI: codemod login.

  4. Generate a Codemod API key: codemod api-keys:create.

  5. Place your API key in a new repository secret under Settings > Secrets and Variables > Actions.

    alt text

  6. Create or move your codemod package(s) under the codemods directory. Note that your codemods should conform to the required package structure. Additionally, make sure that your codemodrc.json file is accurate (reference).

By doing so, any change made to the main branch of your repository will automatically be published to Codemod Registry.

Running codemods

To run your codemods use codemod command below:

$ npx codemod [codemod-name]
  • codemod-name - name of transform. use the name of your codemod in Codemod Registry.

See the codemod CLI doc for a full list of available commands and options.

Important

After using this template, it's recommended that you update this README with:

  1. details about what your codemod does (e.g. before/after code snippets)
  2. a link to the published codemod in Codemod Registry
  3. the accurate run command.

About

An ease-of-life template repo for framework builders and codemod creators to host codemods and automate publishing to the codemod registry.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •