Skip to content

codemod/commons

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Codemod Commons

Codemods, public or private, are preferred to reside in repositories owned by the main organization of their respective projects. This repository serves as a catch-all for some codemod sources that still have not found thier way to their ideal home or for Codemod-compatible forks of existing codemods for easier publishing. Please chat with us before making any major contribution.

Usage

Caution

These scripts change source code. Commit any unsaved changes before running them. Failing to do so may ruin your day.

To run the transform scripts use codemod command below:

$ npx codemod <transform> --target <path> [...options]
  • transform - name of transform. see available transforms below.
  • path - directory to transform. defaults to the current directory.

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

All codemods are also available in the Codemod Registry.

GitHub Action

Use the composite action in this repository to run the Codemod CLI in GitHub Actions:

name: Codemod
on:
  workflow_dispatch:
jobs:
  run-codemod:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run codemod (dry run)
        uses: codemod-com/commons@v0
        with:
          args: "@codemod-com/your-codemod --dry-run"

Notes:

  • inputs.args is passed to npx codemod and defaults to --version.
  • The Action wraps npx -y codemod; no install needed.
  • To publish on Marketplace, create a tagged release (e.g., v0.0.1) and select "Publish this Action to Marketplace" when drafting the release.

About

A catch-all repo for some community-driven codemods.

Resources

License

Stars

Watchers

Forks

Contributors 37