Feature request: Node.js API
I like what this tool does very much, but I don't care for the API. The magic getContentfulEnvironment.js file is sort of weird, and I also don't like exposing an entire Contentful client instance.
It would be super nice to be able to call this from Node, with the locales and content types as plain objects as opposed to a live client. Something like this:
const codegen = require('contentful-typescript-codegen');
const contentTypes = {}; // get from somewhere
const locales = []; // get from somewhere
const options = { output: "./some-file.ts" }; // same options as CLI flags
codegen({ contentTypes, locales }, options);
Just to be clear, I'm not talking about replacing the existing interface, just adding another one.
If you'd accept a PR that does this I'm happy to do the work!
This would be great for complex use cases like multiple spaces or multiple organizations as well.
Closing this as this repo seems dead and I'm not using Contentful at work anymore