-
Notifications
You must be signed in to change notification settings - Fork 467
Expand file tree
/
Copy pathcodegen.ts
More file actions
41 lines (35 loc) · 960 Bytes
/
codegen.ts
File metadata and controls
41 lines (35 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import type { CodegenConfig } from "@graphql-codegen/cli"
import dotenv from "dotenv"
dotenv.config()
const GRAPHQL_API_URL = process.env.CCIP_GRAPHQL_ENDPOINT
const GRAPHQL_AUTH_TOKEN = process.env.CCIP_GRAPHQL_API_KEY
if (!GRAPHQL_API_URL) {
throw new Error("CCIP_GRAPHQL_ENDPOINT is not defined in .env")
}
if (!GRAPHQL_AUTH_TOKEN) {
throw new Error("CCIP_GRAPHQL_API_KEY is not defined in .env")
}
const config: CodegenConfig = {
schema: {
[GRAPHQL_API_URL]: {
headers: {
Authorization: `${GRAPHQL_AUTH_TOKEN}`,
},
},
},
documents: ["./src/lib/ccip/graphql/queries/**/*.ts"],
emitLegacyCommonJSImports: false,
generates: {
"./src/lib/ccip/graphql/__generated__/": {
preset: "client",
presetConfig: {
gqlTagName: "gql",
},
},
"./src/lib/ccip/graphql/schema.graphql.json": {
plugins: ["introspection"],
},
},
ignoreNoDocuments: true,
}
export default config