-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
43 lines (41 loc) · 1.26 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
import { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: 'apps/api/src/**/*.gql',
documents: 'libs/graphql/**/*.gql',
generates: {
'libs/graphql/src/graphql/index.ts': {
plugins: [
'typescript',
'typescript-operations',
'typescript-react-query',
// 'typescript-graphql-request',
],
config: {
// fetcher: 'graphql-request',
fetcher: {
func: '../configs#fetcher',
// func: 'ui#customFetcher',
fetchParams: {
credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
},
},
pureMagicComment: true,
noHOC: true,
noComponents: true,
noNamespaces: true,
withHooks: true,
withSubscriptionHooks: true,
exposeQueryKeys: true, // We use it as the key for the react query without having to manually give a string.
exposeMutationKeys: true, // We use it as the key for the react query without having to manually give a string.
exposeFetcher: true, // exposes a fetch to use for SSR,
},
hooks: {
afterOneFileWrite: ['prettier --write'],
},
},
},
};
export default config;