airbnb / ts-migrate

A tool to help migrate JavaScript code quickly and conveniently to TypeScript
MIT License
5.42k stars 218 forks source link

Custom plugins #41

Open edsrzf opened 4 years ago

edsrzf commented 4 years ago

I'm playing with ts-migrate on our code base and have developed some custom plugins which are useful for us, but probably not general enough to be worth including in ts-migrate itself. I would like to have a way to run these plugins without having to maintain a fork of ts-migrate.

Is this something that the project would consider supporting?

Rudeg commented 4 years ago

ts-migrate-plugins are already used as a separate npm package. You can create a separate package for other plugins as well and use it in the same way.

lencioni commented 4 years ago

Perhaps we could add some documentation that would make it clearer how to do this?

edsrzf commented 4 years ago

So if I want to run custom plugins, it's expected that I write my own CLI-like tool? That seems kinda reasonable but just want to be clear.

Rudeg commented 4 years ago

@edsrzf Yeah, that's one option. Another one would be to create a separate command, for example like reignore In addition, it may be used with the --plugin flag (like you mentioned in PR)

edsrzf commented 4 years ago

That would work for plugins that live in ts-migrate-plugins, but I'm asking about plugins which I believe are not general enough to belong in that package, and so I would not look to open source them.

Rudeg commented 4 years ago

@edsrzf oh, sorry, I miss understand you :( Your own CLI-like tool would be an option (easiest one) or it might be possible to do easier with exposed NodeJS API, however it's not implemented.