-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.ts
More file actions
35 lines (31 loc) · 925 Bytes
/
codegen.ts
File metadata and controls
35 lines (31 loc) · 925 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
import type { CodegenConfig } from "@graphql-codegen/cli";
const projectId = process.env.NEXT_PUBLIC_SANITY_PROJECT_ID;
const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET;
const apiVersion = process.env.NEXT_PUBLIC_SANITY_API_VERSION || "v2023-08-01";
const SANITY_GRAPHQL_URL = `https://${projectId}.api.sanity.io/${apiVersion}/graphql/${dataset}/default`;
const config: CodegenConfig = {
overwrite: true,
schema: SANITY_GRAPHQL_URL,
documents: "./src/graphql/**/*.ts",
generates: {
"./src/generated/graphql.ts": {
plugins: [
{
add: {
content: "/* eslint-disable */\n// @ts-nocheck",
},
},
"typescript",
"typescript-operations",
],
config: {
rawRequest: true,
skipTypename: true,
},
},
"./src/generated/graphql.graphql": {
plugins: ["schema-ast"],
},
},
};
export default config;