-
Notifications
You must be signed in to change notification settings - Fork 29
/
graphql.config.ts
73 lines (69 loc) · 1.57 KB
/
graphql.config.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
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
import { IGraphQLConfig } from "graphql-config";
const baseConfig = {
schema: {
[process.env.HASURA_GRAPHQL_API_ENDPOINT as string]: {
headers: {
"x-hasura-admin-secret": process.env.HASURA_ADMIN_SECRET as string,
},
},
},
overwrite: true,
};
const basePluginConfig = {
maybeValue: "T | null | undefined",
scalars: {
BigInt: "string",
BigDecimal: "string",
Bytes: "string",
timestamptz: "string",
},
};
const config: IGraphQLConfig = {
projects: {
contracts: {
...baseConfig,
documents: ["packages/contracts/graphql/*.graphql"],
extensions: {
codegen: {
generates: {
"packages/contracts/generated/graphql.ts": {
plugins: [
"typescript",
"typescript-operations",
"typescript-urql",
],
config: {
...basePluginConfig,
withHooks: false,
},
},
},
},
},
},
sdk: {
...baseConfig,
documents: [
"packages/sdk/**/*.graphql",
"packages/sdk/**/*.ts",
"!packages/sdk/**/node_modules/**",
],
extensions: {
codegen: {
generates: {
"packages/sdk/src/generated/": {
preset: "client",
config: {
...basePluginConfig,
},
presetConfig: {
fragmentMasking: false,
},
},
},
},
},
},
},
};
export default config;