-
Notifications
You must be signed in to change notification settings - Fork 1
/
codegen.ts
45 lines (42 loc) · 1.11 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
import type { CodegenConfig } from '@graphql-codegen/cli';
const eslintIgnore = {
add: {
content: '/* eslint-disable */',
},
};
const config: CodegenConfig = {
schema: './apps/backend/src/**/*.graphql',
documents: 'apps/wavemail/src/app',
generates: {
// Backend
'apps/backend/src/common/types/gql.g.ts': {
plugins: [eslintIgnore, 'typescript', 'typescript-resolvers'],
config: {
contextType: '../../app#Context',
useIndexSignature: true,
mappers: {
Role: '@prisma/client#PRole',
ProviderType: '@prisma/client#PProviderType',
},
},
},
// Frontend
'apps/wavemail/src/app/common/types/gql.g.ts': {
plugins: [eslintIgnore, 'typescript'],
},
'apps/wavemail/src/app': {
preset: 'near-operation-file',
presetConfig: {
extension: '.g.tsx',
baseTypesPath: 'common/types/gql.g.ts',
},
plugins: [
eslintIgnore,
'typescript-operations',
'typescript-react-apollo',
],
},
},
hooks: { afterAllFileWrite: ['prettier --write'] },
};
export default config;