pbomb / flow-immutable-models

Generates model classes from Flow types using Immutable.js
42 stars 8 forks source link

Babel Transform #22

Open namuol opened 7 years ago

namuol commented 7 years ago

Since you've gone to the trouble of writing JSCodeShift transforms, have you considered using a babel transform instead? They're actually quite similar.

Using babel would make it easier to transparently tweak the underlying implementation without requiring a re-run of the codemods.

Just an idea -- very interesting project! 🙇

pbomb commented 7 years ago

I haven't tried that, but have heard @thejameskyle and @kentcdodds saying good things about that. I'd be up for trying that out and learning what the differences are.

dperetti commented 6 years ago

That would be interesting, however, "visible" generated code makes the developer's life easier in terms of understanding / debugging, and also allows IDEs to do very strong static code analysis.

pbomb commented 6 years ago

I've actually just started on this work. It'll behave the same way as what's there now, just using babel-codemod instead of jscodeshift.

dperetti commented 6 years ago

I hope we will still have the ability to see / use the generated files. Here is an interesting approach (on iOS): https://github.com/rentzsch/mogenerator Two files / classes by model are generated: one which you must leave as is because it's auto-generated, and another one which simply subclasses the first one so you can implement your own methods.

pbomb commented 6 years ago

There will be no change to how the files are generated.