- CLI entry point is
cli.ts
-
scripts
has custom scripts like changing file names, etc. -
transforms
contains different codemod scripts (imported and used intransforms/index.ts
) -
__tests__
contains tests for the codemod -
__testfixtures__
contains test fixtures
yarn codemod <path-to-directory>
yarn test
Tests setup follows the jscodeshift documentation.
JSCodeShift transforms:
- Add a new transform in
transforms
directory, e.g.transforms/my-transform.ts
- Add a corresponding unit test in
__tests__
directory, e.g.__tests__/my-transform.spec.ts
- Add test fixtures in
__testfixtures__
directory, e.g.__testfixtures__/my-transform/basic.input.ts
and__testfixtures__/my-transform/basic.output.ts
- Add a new entry in
transforms/index.ts
to use the new transform - Run tests with
yarn test
Custom scripts:
- Add a new script in
scripts
directory, e.g.scripts/my-script.ts
- Use it in
cli.ts