-
Notifications
You must be signed in to change notification settings - Fork 9
/
codegen.yml
50 lines (44 loc) · 1.33 KB
/
codegen.yml
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
# Configuration for graphql-code-generator
overwrite: true
schema:
- "./src/server/apollo/typeDefs.ts":
noRequire: true
generates:
# Generate types for the resolvers (for the backend)
./src/server/apollo/resolvers/__types__.ts:
plugins:
- "typescript"
- "typescript-resolvers"
config:
contextType: "../ResolverContext#ResolverContext"
immutableTypes: true
maybeValue: T | null | undefined
mappers:
Talk: "../../pretalx#PretalxAPITalk"
Speaker: "../../pretalx#PretalxAPISpeaker"
Room: "../../pretalx#PretalxAPIRoom"
Poster: "../../pretalx#PretalxAPIPoster"
# Generate types for the GraphQL objects for the frontend
./src/apollo/__generated__/types.ts:
plugins:
- typescript
# Generate fully typed React hooks corresponding to the written operations
# (i.e., queries/mutations) for the frontend
./src/:
documents: "./src/components/**/*.graphql"
preset: near-operation-file
presetConfig:
extension: ".generated.tsx"
baseTypesPath: "apollo/__generated__/types.ts"
plugins:
- typescript-operations
- typescript-react-apollo
config:
immutableTypes: true
reactApolloVersion: 3
withComponent: false
withHOC: false
withHooks: true
hooks:
afterAllFileWrite:
- prettier --write