facebook / jscodeshift

A JavaScript codemod toolkit.
https://jscodeshift.com
MIT License
9.14k stars 471 forks source link

Accept code from stdin #228

Open fvictorio opened 6 years ago

fvictorio commented 6 years ago

Is there a way to use jscodeshift with the standard input instead of with a file? (And print the result to stdout) For example:

cat index.js | jscodeshift -t transform.js > transformedIndex.js

This kind of flexibility is very useful in any tool, but I personally would like to have it to be able to pipe code from vim to jscodeshift.

If this is not possible at the moment, is there any chance to have it in the future?

Thanks.

fkling commented 6 years ago

It's not possible at the moment but I guess it would be cool to add. Feel free to create a PR if you have time!

sjy commented 6 years ago

@fvictorio I will take care of this feat if you have not start to working on the PR.

fvictorio commented 6 years ago

@sjy Sure!

sjy commented 6 years ago

251 PR has been submit, comments welcome ~