0.0.3 • Published 9 months ago
@anemone/codemod v0.0.3
Codemod
- CLI entry point is
cli.ts scriptshas custom scripts like changing file names, etc.transformscontains different codemod scripts (imported and used intransforms/index.ts)__tests__contains tests for the codemod__testfixtures__contains test fixtures
Usage
yarn codemod <path-to-directory>Tests
yarn testTests 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
4. 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