-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcodegen.ts
37 lines (35 loc) · 847 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
import { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
overwrite: true,
generates: {
'src/types/graphqlTypes.ts': {
schema: ['./schema.docs.graphql'],
plugins: ['typescript'],
},
'src/types/': {
documents: './src/**/*.graphql',
schema: ['./schema.docs.graphql'],
preset: 'near-operation-file',
config: {
fetcher: {
endpoint: 'endpointUrl',
},
addInfiniteQuery: true,
},
presetConfig: {
extension: '.generated.tsx',
baseTypesPath: 'graphqlTypes.ts',
},
plugins: [
'typescript-operations',
'typescript-react-query',
{
add: {
content: "const endpointUrl = '/api/graphql';",
},
},
],
},
},
};
export default config;