-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
35 lines (33 loc) · 976 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
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
overwrite: true,
schema: './app/api/graphql/schema.graphql',
documents: ['./app/api/graphql/queries.graphql'],
generates: {
'./app/api/graphql/__generated__/types.ts': {
plugins: ['typescript'],
},
'./app/api/graphql/__generated__/documents.ts': {
plugins: ['typescript-document-nodes'],
},
'./app/api/graphql/__generated__/': {
preset: 'near-operation-file',
presetConfig: {
baseTypesPath: 'types.ts',
fileName: 'hooks',
folder: '__generated__',
extension: '.tsx',
},
plugins: ['typescript-operations', 'typescript-react-apollo'],
config: {
withHooks: true,
documentMode: 'external',
importDocumentNodeExternallyFrom: '../__generated__/documents',
},
},
},
hooks: {
afterOneFileWrite: ['prettier --write'],
},
};
export default config;