forked from cypress-io/cypress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphql-codegen.yml
131 lines (119 loc) · 4.23 KB
/
graphql-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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# https://www.graphql-code-generator.com/docs/getting-started/index
documentFilters: &documentFilters
immutableTypes: true
useTypeImports: true
preResolveTypes: true
onlyOperationTypes: true
avoidOptionals: true
vueOperations: &vueOperations
schema: './packages/graphql/schemas/schema.graphql'
config:
<<: *documentFilters
plugins:
- add:
content: '/* eslint-disable */'
- 'typescript'
- 'typescript-operations'
- 'typed-document-node':
# Intentionally specified under typed-document-node rather than top level config,
# because we don't want it flattening the types for the operations
flattenGeneratedTypes: true
vueTesting: &vueTesting
schema: './packages/graphql/schemas/schema.graphql'
config:
<<: *documentFilters
plugins:
- add:
content: '/* eslint-disable */'
- 'typescript'
- 'typescript-operations':
# For modifying in mountFragment
immutableTypes: false
- 'typed-document-node'
overwrite: true
config:
enumsAsTypes: true
declarationKind: 'interface'
strictScalars: true
scalars:
Date: string
DateTime: string
JSON: any
generates:
###
# Generates types for us to infer the correct "source types" when we mock out on the frontend
# This ensures we have proper type checking when we're using cy.mountFragment in component tests
###
'./packages/frontend-shared/cypress/support/generated/test-graphql-types.gen.ts':
schema: 'packages/graphql/schemas/schema.graphql'
plugins:
- add:
content: '/* eslint-disable */'
- 'typescript':
nonOptionalTypename: true
- 'packages/frontend-shared/script/codegen-type-map.js'
'./packages/graphql/src/gen/test-cloud-graphql-types.gen.ts':
schema: 'packages/graphql/schemas/cloud.graphql'
plugins:
- add:
content: '/* eslint-disable */'
- 'typescript':
nonOptionalTypename: true
- 'packages/frontend-shared/script/codegen-type-map.js'
'./packages/graphql/src/gen/cloud-source-types.gen.ts':
config:
useTypeImports: true
schema: 'packages/graphql/schemas/cloud.graphql'
plugins:
- add:
content: '/* eslint-disable */'
- 'typescript'
- 'typescript-resolvers'
###
# Generates types for us to infer the correct keys for graphcache
###
'./packages/data-context/src/gen/graphcache-config.gen.ts':
config:
useTypeImports: true
schema: 'packages/graphql/schemas/schema.graphql'
plugins:
- add:
content: '/* eslint-disable */'
- typescript
- typescript-urql-graphcache
###
# All of the GraphQL Query/Mutation documents we import for use in the .{vue,ts,tsx,js,jsx}
# files for useQuery / useMutation, as well as types associated with the fragments
###
'./packages/launchpad/src/generated/graphql.ts':
documents:
- './packages/launchpad/src/**/*.{vue,ts,tsx,js,jsx}'
- './packages/frontend-shared/src/**/*.{vue,ts,tsx,js,jsx}'
<<: *vueOperations
'./packages/app/src/generated/graphql.ts':
documents:
- './packages/app/src/**/*.{vue,ts,tsx,js,jsx}'
- './packages/frontend-shared/src/**/*.{vue,ts,tsx,js,jsx}'
<<: *vueOperations
'./packages/frontend-shared/src/generated/graphql.ts':
documents: './packages/frontend-shared/src/{gql-components,graphql,composables}/**/*.{vue,ts,tsx,js,jsx}'
<<: *vueOperations
###
# All GraphQL documents imported into the .spec.tsx files for component testing.
# Similar to generated/graphql.ts, except it doesn't include the flattening for the document nodes,
# so we can actually use the document in cy.mountFragment
###
'./packages/launchpad/src/generated/graphql-test.ts':
documents:
- './packages/launchpad/src/**/*.{vue,ts,tsx,js,jsx}'
- './packages/frontend-shared/src/**/*.{vue,ts,tsx,js,jsx}'
<<: *vueTesting
'./packages/app/src/generated/graphql-test.ts':
documents:
- './packages/app/src/**/*.{vue,ts,tsx,js,jsx}'
- './packages/frontend-shared/src/gql-components/**/*.{vue,ts,tsx,js,jsx}'
<<: *vueTesting
'./packages/frontend-shared/src/generated/graphql-test.ts':
documents:
- './packages/frontend-shared/src/gql-components/**/*.{vue,ts,tsx,js,jsx}'
<<: *vueTesting