-
Notifications
You must be signed in to change notification settings - Fork 1
/
codegen.ts
55 lines (53 loc) · 1.39 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
45
46
47
48
49
50
51
52
53
54
55
import type { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
overwrite: true,
schema: ["./src/schema/schema.graphql", "./src/schema/localSchema.graphql"],
documents: "src/**/*.{ts,tsx}",
hooks: {
afterAllFileWrite: ["prettier --write"],
},
generates: {
"./src/__generated__/types.ts": {
plugins: ["typescript"],
config: {
avoidOptionals: {
field: true,
inputValue: false,
object: false,
defaultValue: false,
},
defaultScalarType: "unknown",
namingConvention: {
typeNames: "keep",
enumValues: "change-case-all#upperCase",
},
},
},
"./": {
preset: "near-operation-file",
plugins: ["typescript-operations"],
presetConfig: {
baseTypesPath: "./src/__generated__/types.ts",
extension: ".types.ts",
folder: "__generated__",
importTypesNamespace: "GraphQLTypes",
},
config: {
dedupeOperationSuffix: true,
avoidOptionals: {
field: true,
inputValue: false,
object: false,
defaultValue: false,
},
nonOptionalTypename: true,
skipTypeNameForRoot: true,
namingConvention: {
typeNames: "keep",
enumValues: "change-case-all#upperCase",
},
},
},
},
};
export default config;