Skip to content
/ jasat Public

Codemod for JavaScript Stuff (Jasat is shortname)

Notifications You must be signed in to change notification settings

r17x/jasat

Repository files navigation

jasat overview Tools for code moderation, transformation, or use for maintain JavaScript stuff related.

CI Release status NPM jasat version

Use caseUsageSpecial ThanksAlternativeContributionLicense

Use case

  • find and replace some code.
  • remove some code (like console.log).

Usage

Using with npx

npx jasat <TRANSFORM> [OPTIONS]

Using as development dependencies

add in devDependencies

yarn add -D jasat

run

yarn jasat <TRANSFORM> [OPTIONS]

Transforms

Name OPTIONS
import-source-replace "FROM" "TO"
remove-console -

Command OPTIONS

  Tools for code moderation, transformation, or use for maintain JavaScript stuff related.

  USAGE
    npx jasat <TRANSFORM> <...OPTIONS>

  OPTIONS
    --write, -w         Allow to modified target file.
    --cwd, -C           Set current working directory (default: `process.cwd()`).
    --help, -h          Print help.
    --list, -l          Print list of TRANSFORM.
    --version, -v       Print version.

Example

npx jasat import-source-replace "react" "preact" // dry-run
npx jasat import-source-replace "react" "preact" --write // write to system or target files

Special Thanks

  • equivalent-exchange - Transmute one JavaScript string into another by way of mutating its AST. Powered by babel and recast.

Alternative

  • jscodeshift - A JavaScript codemod toolkit.
  • comby - A tool for structural code search and replace that supports ~every language.

Contribution

Making pull requests

License

MIT