-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.js
78 lines (77 loc) · 1.8 KB
/
codegen.js
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const {
HASURA_GRAPHQL_ADMIN_SECRET = "IiiRhd7dcnRtFZ4DHWwYu7uAQxUXOPUaqJF7OY6G8tCJqigg0nqUrZMKcx4vQddY",
HASURA_GRAPHQL_ENDPOINT = "https://neno.hasura.app/v1/graphql",
} = process.env;
module.exports = {
overwrite: true,
schema: [
"src/lib/graphql/schema.graphql",
{
[HASURA_GRAPHQL_ENDPOINT]: {
headers: {
"x-hasura-access-key": HASURA_GRAPHQL_ADMIN_SECRET,
},
},
},
],
documents: [
"src/**/*.{ts,tsx}",
"!**/*.test.*",
"!**/__mocks__/**/*",
"!**/*.test.tsx",
"!**/*.js",
"!**/types/*",
"!**/globalTypes.ts/*",
],
hooks: {
afterAllFileWrite: ["prettier --write"],
},
config: {
dedupeOperationSuffix: true,
preResolveTypes: true,
immutableTypes: false,
transformUnderscore: true,
scalars: {
uuid: "string",
id: "string",
int8: "string",
bigint: "string",
numeric: "number",
varbit: "string",
bit: "string",
char: "string",
varchar: "string",
bool: "boolean",
int: "number",
int4: "number",
jsonb: "Record<string, any>",
_text: "string",
date: "string",
json: "Record<string, any>",
citext: "string",
timestamp: "string",
float8: "number",
timestamptz: "string",
},
},
generates: {
"src/lib/graphql/globalTypes.ts": {
hooks: {
afterAllFileWrite: ["prettier --write"],
},
plugins: ["typescript"],
},
"src/lib": {
preset: "near-operation-file",
presetConfig: {
baseTypesPath: "graphql/globalTypes.ts",
folder: "__generated__",
extension: ".ts",
},
plugins: ["typescript-operations", "typescript-react-apollo"],
},
"src/lib/__mocks__/schema.json": {
plugins: ["introspection"],
},
},
};