-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.ts
More file actions
40 lines (38 loc) · 1.14 KB
/
codegen.ts
File metadata and controls
40 lines (38 loc) · 1.14 KB
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
import type { CodegenConfig } from '@graphql-codegen/cli';
import { addTypenameSelectionDocumentTransform } from '@graphql-codegen/client-preset';
import { printSchema } from 'graphql';
import { schema } from '~/graphql/schema';
const config: CodegenConfig = {
schema: printSchema(schema),
documents: ['src/**/*.tsx', 'src/**/*.ts'],
generates: {
'./src/app/graphql/generated/': {
preset: 'client',
presetConfig: {
persistedDocuments: true,
fragmentMasking: { unmaskFunctionName: 'getFragment' },
},
documentTransforms: [addTypenameSelectionDocumentTransform],
plugins: [],
config: {
nonOptionalTypename: true,
dedupeFragments: true,
scalars: {
// ISOString (i.e. "2024-05-13T15:58:12.957Z")
DateTime: 'string',
Date: 'string',
},
},
},
'./src/app/graphql/generated/type-policies.ts': {
plugins: ['typescript-apollo-client-helpers'],
},
'./src/app/graphql/generated/schema.graphql': {
plugins: ['schema-ast'],
config: {
includeDirectives: true,
},
},
},
};
export default config;