-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.ts
More file actions
42 lines (39 loc) · 1.32 KB
/
Copy pathcodegen.ts
File metadata and controls
42 lines (39 loc) · 1.32 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
import {CodegenConfig} from "@graphql-codegen/cli";
const enumValues = {
EventType: "./schema#EventType",
ImpexType: "./schema#ImpexType",
ReportType: "./schema#ReportType",
SortDirection: "./schema#SortDirection",
SourceType: "./schema#SourceType",
TypeType: "./schema#TypeType",
};
const config: CodegenConfig = {
schema: process.env.API_GRAPHQL_ENDPOINT || "",
documents: ["src/**/*.{ts,tsx}", "!src/gql/**"],
ignoreNoDocuments: true,
generates: {
// Full schema object types + real enums. The app imports domain types
// (`Spexare`, `Event`, `SortDirection`, …) from `@/gql/schema`.
"./src/gql/schema.ts": {
plugins: ["typescript"],
config: {
defaultScalarType: "any",
},
},
// Typed `graphql()` documents (client-preset). Operation/variable/input types
// live here; enums are re-used from `./schema` so they share identity with the
// domain code. Fragment masking is off for now.
"./src/gql/": {
preset: "client",
presetConfig: {
fragmentMasking: false,
},
config: {
enumValues,
defaultScalarType: "any",
},
plugins: [],
},
},
};
export default config;