-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
36 lines (34 loc) · 841 Bytes
/
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
import { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
schema: "server/graphql/schema/*.graphqls",
documents: "client/src/**/*.graphql",
ignoreNoDocuments: true,
hooks: {
afterAllFileWrite: "npx prettier --write client/src/types/graphql.ts",
},
config: {
avoidOptionals: true,
immutableTypes: true,
useTypeImports: true,
mergeFragmentTypes: true,
nonOptionalTypename: true,
useImplementingTypes: true,
flattenGeneratedTypes: true,
defaultScalarType: "unknown",
inlineFragmentTypes: "combine",
namingConvention: {
enumValues: "change-case#upperCase",
},
scalars: {
UUID: "string",
Price: "number",
Timestamp: "string",
},
},
generates: {
"client/src/types/graphql.ts": {
plugins: ["typescript", "typescript-operations"],
},
},
};
export default config;