mrjono1 / joi-to-typescript

Convert Joi Schemas to TypeScript interfaces
MIT License
126 stars 40 forks source link

Add CLI interface #183

Open henhal opened 2 years ago

henhal commented 2 years ago

It would be nice if this tool had a simple CLI interface such as

$ npx joi-to-typescript --schema-dir ./schemas --output-dir ./types --sort-by-name

I use this great tool in many projects, and I usually end up wrapping it in a simple file which simply calls convertFromDirectory() with my directories as parameters, and adding that wrapper file seems a bit redundant really.

Would a PR for this be of interest? If so, any preference on CLI helpers - meow? Any thoughts on syntax? To me, the most relevant usage is to convert a directory of schema files and store the generated files in another directory, as per the example above. And options should be fairly straight-forward. Would this be sufficient or is there a need for e.g. converting a single schema file etc?

mrjono1 commented 2 years ago

A cli for this tool would be great, I've thought about it a few times, but never spent the time to finish figuring it out.

If you have a go at it that would be great, I am open to Pull Requests

henhal commented 2 years ago

Thanks @mrjono1. I whipped up a PR.

throrin19 commented 1 year ago

Any news about that MR ?