-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
45 lines (44 loc) · 1.36 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 config: CodegenConfig = {
schema: 'pkg/graph/schema.graphql',
documents: ['src/gql/apolloGQL/**/*.ts'],
overwrite: true,
generates: {
'./src/gql/gen/graphql.ts': {
plugins: [
'typescript',
'typescript-operations',
'typescript-react-apollo',
{
// This plugin is used to generate type document query types. Used when passing a mutation or query to a custom hook
'typed-document-node': {
transformUnderscore: false,
documentVariablePrefix: 'Typed',
fragmentVariablePrefix: 'Typed'
}
}
],
config: {
withHooks: true,
scalars: {
// old codegen mappings from global.d.ts
// maintain until we add better scalar mapping with graphql-codegen
//
// These currently just need to map to aliased types there
// Hopefully in the future we can use custom/useful types!
Time: 'Time',
UUID: 'UUID',
Upload: 'Upload',
EmailAddress: 'EmailAddress',
HTML: 'HTML'
},
nonOptionalTypename: true,
namingConvention: {
enumValues: 'change-case-all#upperCase#snakeCase',
typeNames: 'lodash#upperFirst'
}
}
}
}
};
export default config;