-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.yml
67 lines (62 loc) · 2.01 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
overwrite: true
hooks:
afterAllFileWrite:
# - yarn eslint --fix
- yarn prettier --write
# If you're in the bind of not being able to run the app because of a codegen error
# but you can't run codegen because you can't run the app - uncomment this, run codegen and comment it back
# schema: schema.graphql
schema: http://127.0.0.1:4000/api/graphql
config:
scalars:
# uuid: string
JSON: Record<string, any>
JSONObject: Record<string, any>
DateTime: string
Int64: number
_Any: any
Void: void
generates:
schema.graphql:
plugins:
- schema-ast
# Generate Typescript types to be imported by other generators
libs/shared/abstract/codegen/src/types.api.graphql.gen.ts:
documents:
- '{apps,libs}/**/*.graphql'
plugins:
- typescript
# We want to generate another copy in `shared` folder so our interfaces can access this
# This will be a duplicate copy of operation types from the `near-operation-file` plugin
- typescript-operations
# - typed-document-node
config:
# constEnums: true
inlineFragmentTypes: combine
# enumsAsTypes: true
namingConvention:
enumValues: keep
# dedupeFragments: true
# This somehow generates for web-e2e as well, even if ./libs
./:
documents:
- '**/*.{endpoints,fragment}.graphql'
preset: near-operation-file
presetConfig:
extension: .graphql.gen.ts
baseTypesPath: ~@codelab/shared/abstract/codegen
# This forces us to export fragment types, we want to export our own DTO naming instead
# importAllFragmentsFrom: ~@codelab/frontend/abstract/core
plugins:
- typescript-operations
- typescript-graphql-request
config:
inlineFragmentTypes: combine
# documentVariableSuffix: Gql
# We want to parse to ASTNode
gqlImport: 'graphql-tag#gql'
# gqlImport: 'graphql-request#gql'
skipTypename: true
strictScalars: true
defaultScalarType: unknown
# dedupeFragments: true