forked from zammad/zammad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.graphql_code_generator.js
72 lines (69 loc) · 1.8 KB
/
.graphql_code_generator.js
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
// @ts-check
/** @type {import('@graphql-codegen/cli').CodegenConfig['generates'][string]} */
const mockerPreset = {
documents:
['app/frontend/**/{queries,mutations,subscriptions}/**/*.graphql'],
preset: 'near-operation-file',
presetConfig: {
baseTypesPath: '~#shared/graphql/types.ts',
importTypesNamespace: '',
extension: '.mocks.ts',
},
plugins: [
'./app/frontend/build/mocksGraphqlPlugin.js',
],
config: {
importOperationTypesFrom: 'Types',
skipDocumentsValidation: {
skipValidationAgainstSchema: true,
},
},
}
/** @type {import('@graphql-codegen/cli').CodegenConfig} */
const config = {
overwrite: true,
schema: 'app/graphql/graphql_introspection.json',
config: {
vueCompositionApiImportFrom: 'vue',
addDocBlocks: false,
},
generates: {
'./app/frontend/shared/graphql/types.ts': {
documents:
['app/frontend/shared/**/*.graphql', 'app/frontend/apps/**/*.graphql'],
config: {
scalars: {
BinaryString: 'string',
NonEmptyString: 'string',
FormId: 'string',
ISO8601Date: 'string',
ISO8601DateTime: 'string',
},
},
plugins: [
'typescript',
'typescript-operations',
]
},
'./app/frontend/': {
documents:
['app/frontend/shared/**/*.graphql', 'app/frontend/apps/**/*.graphql'],
preset: 'near-operation-file',
presetConfig: {
baseTypesPath: '~#shared/graphql/types.ts',
importTypesNamespace: '',
extension: '.api.ts',
},
plugins: [
'typescript-vue-apollo',
],
config: {
importOperationTypesFrom: 'Types'
}
},
// generate mocks
'./app/frontend/apps/': mockerPreset,
'./app/frontend/shared/': mockerPreset,
},
}
module.exports = config