Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing utils / helpers in some way #298

Open
cbranch101 opened this issue Jul 6, 2021 · 2 comments
Open

Exposing utils / helpers in some way #298

cbranch101 opened this issue Jul 6, 2021 · 2 comments

Comments

@cbranch101
Copy link

cbranch101 commented Jul 6, 2021

We're considering creating our own React codemods, and it seems like a lot of the legwork you've done in this repo would be useful to build off of, would it be possible to bundle up and export the contents of the utils file and maybe a few other useful functions in an index file and add a main.js to the package.json?

@cbranch101
Copy link
Author

Of course copypasta is an option, but it seems like it might be cool if there was a core api for creating react code mods

@alirezamirian
Copy link

alirezamirian commented Aug 24, 2022

react-codemod is two things now:

  • A bunch of jscodeshift transforms
  • A CLI to run the transforms

The CLI has some nice features like checking git status, dry run, etc. which is relevant regardless of the transform.
Letting the CLI be used with custom transforms allows others to leverage those features without redoing the same, in a custom CLI tool.
This seems feasible with a minor change in react-codemod cli, to let transform be a name of a predefined transform (as is now), or path to a transform file.

npx react-codemod <transformNameOrPath> <path> [...options]

UPDATE: I see now that dry-run for example is supported by the original jscodeshift cli, so maybe one could use jscodeshift cli directly for custom transform, but still it might be relevant to have the CLI of react-codemod reusable for custom transforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants