-
Notifications
You must be signed in to change notification settings - Fork 155
/
codegen.ts
57 lines (56 loc) · 1.43 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { CodegenConfig } from '@graphql-codegen/cli';
export default {
schema: 'https://kitsu.io/api/graphql',
documents: 'src/**/*.gql',
hooks: {
afterAllFileWrite: ['prettier --write'],
},
generates: {
'src/graphql/schema.json': {
plugins: ['introspection'],
config: {
includeScalars: true,
includeEnums: true,
includeInputs: true,
},
},
'src/graphql/types.ts': {
plugins: ['typescript'],
config: {
immutableTypes: true,
scalars: {
Map: 'Record<string, string>',
JSON: 'unknown',
Date: 'Date',
ISO8601Date: 'Date',
ISO8601DateTime: 'Date',
},
},
},
'src/': {
preset: 'near-operation-file',
presetConfig: {
extension: '-gql.ts',
baseTypesPath: 'graphql/types.ts',
},
config: {
documentMode: 'documentNodeImportFragments',
skipTypename: true,
dedupeOperationSuffix: true,
dedupeFragments: true,
skipDocumentsValidation: {
skipDuplicateValidation: true,
ignoreRules: ['UniqueFragmentNames'],
},
scalars: {
Map: 'Record<string, string>',
JSON: 'unknown',
Date: 'Date',
ISO8601Date: 'Date',
ISO8601DateTime: 'Date',
},
},
plugins: ['typescript-operations', 'typescript-urql'],
},
},
} satisfies CodegenConfig;