-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathcodegen-main.ts
More file actions
99 lines (97 loc) · 2.7 KB
/
codegen-main.ts
File metadata and controls
99 lines (97 loc) · 2.7 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import { type CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
schema: "./schema-main.graphql",
documents: [
"./src/**/queries.ts",
"./src/**/mutations.ts",
"./src/**/fragments/*.ts",
"./src/searches/*.ts",
// covered by codegen-staging
"!./src/**/queries.staging.ts",
"!./src/**/mutations.staging.ts",
"!./src/**/fragments/*.staging.ts",
"!./src/searches/*.staging.ts",
// legacy SDK has its own internal GraphQL operations
"!./src/legacy-sdk/**",
],
generates: {
"./src/graphql/fragmentTypes.generated.ts": {
plugins: ["fragment-matcher"],
config: {
minify: false,
apolloClientVersion: 3,
},
},
"./src/graphql/typePolicies.generated.ts": {
plugins: ["typescript-apollo-client-helpers"],
},
"./src/graphql/types.generated.ts": {
plugins: ["typescript", "typescript-operations"],
config: {
scalars: {
Day: "number",
Hour: "number",
Date: "string",
// TODO Enable and fix types one by one
// _Any: "unknown",
// DateTime: "string",
// Decimal: "number",
// Minute: "number",
// GenericScalar: "JSONValue",
JSON: "unknown",
JSONString: "string",
// Metadata: "Record<string, string>",
// PositiveDecimal: "number",
// Upload: "unknown",
// UUID: "string",
// WeightScalar: "number",
},
nonOptionalTypename: true,
avoidOptionals: {
field: true,
inputValue: false,
object: false,
defaultValue: false,
},
namingConvention: {
enumValues: "change-case-all#upperCase",
},
onlyOperationTypes: true,
},
},
"./src/graphql/hooks.generated.ts": {
plugins: ["typescript-react-apollo"],
config: {
withHooks: true,
apolloReactHooksImportFrom: "@dashboard/hooks/graphql",
},
preset: "import-types",
presetConfig: {
typesPath: "./types.generated",
},
},
"./src/graphql/fabbricaTypes.generated.ts": {
plugins: ["typescript"],
config: {
enumsAsTypes: true,
avoidOptionals: true,
nonOptionalTypename: true,
scalars: {
Day: "number",
Hour: "number",
Date: "string",
},
namingConvention: {
enumValues: "change-case-all#upperCase",
},
},
},
"./src/graphql/fabbrica.generated.ts": {
plugins: ["@mizdra/graphql-codegen-typescript-fabbrica"],
config: {
typesFile: "./fabbricaTypes.generated",
},
},
},
};
export default config;