@gel/codemod

1.0.1 • Public • Published

Codemod

  • CLI entry point is cli.ts
  • scripts has custom scripts like changing file names, etc.
  • transforms contains different codemod scripts (imported and used in transforms/index.ts)
  • __tests__ contains tests for the codemod
  • __testfixtures__ contains test fixtures

Usage

yarn codemod <path-to-directory>

Tests

yarn test

Tests setup follows the jscodeshift documentation.

Development

JSCodeShift transforms:

  1. Add a new transform in transforms directory, e.g. transforms/my-transform.ts
  2. Add a corresponding unit test in __tests__ directory, e.g. __tests__/my-transform.spec.ts
  3. Add test fixtures in __testfixtures__ directory, e.g. __testfixtures__/my-transform/basic.input.ts and __testfixtures__/my-transform/basic.output.ts
  4. Add a new entry in transforms/index.ts to use the new transform
  5. Run tests with yarn test

Custom scripts:

  1. Add a new script in scripts directory, e.g. scripts/my-script.ts
  2. Use it in cli.ts

Readme

Keywords

none

Package Sidebar

Install

npm i @gel/codemod

Weekly Downloads

198

Version

1.0.1

License

Apache-2.0

Unpacked Size

19 kB

Total Files

16

Last publish

Collaborators

  • scotttrinh
  • 1st1