-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathcodegen.ts
52 lines (49 loc) · 1.34 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
import { CodegenConfig } from '@graphql-codegen/cli';
import { fetchConfig } from './src/lib/fetchConfig';
export const config: CodegenConfig = {
overwrite: true,
ignoreNoDocuments: true,
schema: [
{
[fetchConfig.endpoint]: fetchConfig.params,
},
],
generates: {
'./src/lib/__generated/graphql.schema.json': {
plugins: ['introspection'],
},
'./src/lib/__generated/graphql.schema.graphql': {
plugins: ['schema-ast'],
},
'./src/lib/__generated/graphql.types.ts': {
plugins: ['typescript', 'typescript-operations'],
documents: ['./src/**/*.graphql'],
},
'./src/': {
documents: ['./src/**/*.graphql'],
preset: 'near-operation-file',
presetConfig: {
extension: '.generated.ts',
baseTypesPath: 'lib/__generated/graphql.types.ts',
folder: '__generated',
},
plugins: [
'typescript-operations',
'typescript-react-query',
],
config: {
exposeQueryKeys: true,
exposeFetcher: true,
rawRequest: false,
inlineFragmentTypes: 'combine',
skipTypename: false,
exportFragmentSpreadSubTypes: true,
dedupeFragments: true,
preResolveTypes: true,
withHooks: true,
fetcher: '@src/lib/fetchConfig#customFetcher',
},
},
},
};
export default config;