-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodegen.ts
44 lines (41 loc) · 1.1 KB
/
codegen.ts
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
43
44
import type { CodegenConfig } from "@graphql-codegen/cli";
import { addTypenameSelectionDocumentTransform } from "@graphql-codegen/client-preset";
import dotenv from "dotenv";
dotenv.config();
const GRAPHQL_SUPABASE_URL = import.meta.env.VITE_SUPABASE_URL + "/graphql/v1";
const SUPABASE_KEY = import.meta.env.VITE_SUPABASE_KEY;
const config: CodegenConfig = {
schema: [
{
[GRAPHQL_SUPABASE_URL]: {
headers: {
apikey: SUPABASE_KEY,
Authorization: `Bearer ${SUPABASE_KEY}`,
},
},
},
], // Using the local endpoint, update if needed
documents: "src/**/*.tsx",
overwrite: true,
ignoreNoDocuments: true,
generates: {
"src/gql/": {
preset: "client",
documentTransforms: [addTypenameSelectionDocumentTransform],
plugins: [],
config: {
scalars: {
UUID: "string",
Date: "string",
Time: "string",
Datetime: "string",
JSON: "string",
BigInt: "string",
BigFloat: "string",
Opaque: "any",
},
},
},
},
};
export default config;