-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.ts
More file actions
42 lines (39 loc) · 999 Bytes
/
Copy pathcodegen.ts
File metadata and controls
42 lines (39 loc) · 999 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
42
import type { CodegenConfig } from "@graphql-codegen/cli";
import { loadEnv } from "vite";
const { DATOCMS_TOKEN } = loadEnv(
process.env.NODE_ENV ?? "development",
process.cwd(),
""
);
const config: CodegenConfig = {
schema: [
{
"https://graphql.datocms.com/": {
headers: { Authorization: `Bearer ${DATOCMS_TOKEN}` },
},
},
],
documents: ["**/*.graphql"],
generates: {
".generated/datocms.ts": {
plugins: ["typescript", "typescript-operations"],
config: {
dedupeFragments: true,
strictScalars: true,
scalars: {
BooleanType: "boolean",
CustomData: "Record<string, unknown>",
Date: "string",
DateTime: "string",
FloatType: "number",
IntType: "number",
ItemId: "string",
JsonField: "unknown",
MetaTagAttributes: "Record<string, string>",
UploadId: "string",
},
},
},
},
};
export default config;