Files
js/codegen.ts
T
Jonas DanielsandJoaquim Verges 0c0cfdad84 Jd/cleanup (#2258)
* remove unused gql queries

* remove generated file

* init knip

* run knip and remove unused

* lock

---------

Co-authored-by: Joaquim Verges <[email protected]>
2024-02-28 17:58:56 +00:00

47 lines
1.0 KiB
TypeScript

import { CodegenConfig } from "@graphql-codegen/cli";
import dotenv from "dotenv";
dotenv.config();
const API_URL = process.env.NEXT_PUBLIC_PAYMENTS_API;
const ADMIN_SECRET = process.env.PAYMENTS_ADMIN_SECRET;
if (!API_URL) {
throw new Error("Missing NEXT_PUBLIC_PAYMENTS_API environment variable");
}
if (!ADMIN_SECRET) {
throw new Error("Missing PAYMENTS_ADMIN_SECRET environment variable");
}
const config: CodegenConfig = {
overwrite: true,
schema: [
{
[API_URL as string]: {
headers: {
"X-Hasura-Admin-Secret": ADMIN_SECRET,
},
},
},
],
// emitLegacyCommonJSImports: false,
// this is annoying, would be better if all of our code was in src/
documents: ["./graphql/**/*.graphql"],
generates: {
"./graphql/generated.ts": {
plugins: [
"typescript",
"typescript-operations",
"typescript-react-apollo",
],
config: {
useTypeImports: true,
withComponent: false,
},
},
},
ignoreNoDocuments: true,
};
export default config;