-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
40 lines (38 loc) · 985 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
37
38
39
40
import { CodegenConfig } from '@graphql-codegen/cli'
const config: CodegenConfig = {
schema: [
'src/lib/generated/overrides.graphql',
{
[process.env.NEXT_PUBLIC_GRAPHQL_URL || '']: {
headers: {
'X-Hasura-Admin-Secret': process.env.NEXT_PUBLIC_GRAPHQL_SECRET || '',
},
},
},
],
documents: 'src/modules/**/*.graphql',
overwrite: true,
generates: {
'src/lib/generated/graphql.types.ts': {
plugins: ['typescript'],
hooks: {
afterOneFileWrite: ['eslint --fix'],
},
},
'src/lib/generated/graphql.schema.json': {
plugins: ['introspection'],
},
'src/modules': {
preset: 'near-operation-file',
presetConfig: {
extension: '.ts',
baseTypesPath: '~@/lib/generated/graphql.types',
},
plugins: ['typescript-operations', 'typescript-urql'],
hooks: {
afterOneFileWrite: ['eslint --fix'],
},
},
},
}
export default config