Programmatic usage (library)

If you prefer using a script file instead of the cli you can use the generate function
javascript
import { generate } from "@genql/cli"; import fs from "fs"; import path from "path"; generate({ schema: fs.readFileSync(path.join(__dirname, "schema.graphql")).toString(), output: path.join(__dirname, "generated"), scalarTypes: { MongoID: "string", }, }).catch(console.error);
Share