-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcodegen.ts
39 lines (37 loc) · 952 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
38
39
import { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: './src/graphql/schema.gql',
ignoreNoDocuments: true,
generates: {
'src/graphql/type.tsx': {
plugins: [
'typescript',
'typescript-operations',
'typescript-resolvers',
'typescript-react-apollo',
],
config: {
withHooks: true,
useIndexSignature: true,
enumsAsTypes: true,
constEnums: true,
skipTypename: false,
dedupeOperationSuffix: true,
nonOptionalTypename: true,
preResolveTypes: true,
namingConvention: {
enumValues: 'keep',
},
scalars: {
Date: 'Date',
},
},
},
},
hooks: {
afterOneFileWrite: ['prettier --write'],
afterAllFileWrite: ['echo "✨ GraphQL types generated successfully"'],
},
watch: ['./src/graphql/schema.gql'],
};
export default config;