-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcodegen.ts
More file actions
73 lines (66 loc) · 2.7 KB
/
Copy pathcodegen.ts
File metadata and controls
73 lines (66 loc) · 2.7 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: './schema.graphql',
// see https://the-guild.dev/graphql/codegen/docs/guides/react-vue:
ignoreNoDocuments: true, // for better experience with the watcher
generates: {
'app/apollo/__gen__/possibleTypes.ts': {
// required to handle fragments with unions
// see https://www.apollographql.com/docs/react/data/fragments#generating-possibletypes-with-graphql-codegen
plugins: ['fragment-matcher'],
config: {
useExplicitTyping: true,
},
},
'app/apollo/__gen__/': {
overwrite: true,
preset: 'client',
presetConfig: {
// codegen's masking is incompatible with apollo with preset-client:
// https://www.apollographql.com/docs/react/data/fragments#with-the-client-preset
// disables the incompatible GraphQL Codegen fragment masking feature:
fragmentMasking: false,
},
config: {
//Note: Apollo Client users can still use
nonOptionalTypename: true,
skipTypeNameForRoot: true,
// re-enable types?? https://the-guild.dev/graphql/codegen/plugins/typescript/typescript#nonOptionalTypename
// no effect
///nonOptionalTypename: true,
// https://the-guild.dev/graphql/codegen/plugins/typescript/typescript#skiptypename
//strictScalars: false,
// defaultScalarType
//defaultScalarType: 'any',
// https://the-guild.dev/graphql/codegen/plugins/typescript/typescript#scalars
/*
scalars: {
//Unknown scalar type Base64String
// not used in this project
Base64String: 'string',
BigInt: 'number',
},
*/
// need to add when fragmentMasking is disabled:
// https://www.apollographql.com/docs/react/data/fragments#with-the-client-preset
customDirectives: {
apolloUnmask: true,
},
inlineFragmentTypes: 'mask',
},
documents: [
'app/apollo/**/*.tsx',
'app/apollo/**/*.graphql',
'apollo/**/*.tsx',
'apollo/*.tsx',
'apollo/**/*.graphql',
'!**/__generated_/**',
'!src',
],
},
},
hooks: {
afterAllFileWrite: ['prettier --write'],
},
};
export default config;