-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodegen.ts
84 lines (81 loc) · 2.44 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
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
74
75
76
77
78
79
80
81
82
83
84
/*
* SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { CodegenConfig } from '@graphql-codegen/cli';
import type { TypeScriptTypedDocumentNodesConfig } from '@graphql-codegen/typed-document-node';
import type { TypeScriptPluginConfig } from '@graphql-codegen/typescript';
import type { TypeScriptDocumentsPluginConfig } from '@graphql-codegen/typescript-operations';
const config: CodegenConfig = {
overwrite: true,
schema:
'https://raw.githubusercontent.com/zextras/carbonio-files-ce/refs/heads/develop/core/src/main/resources/api/public-schema.graphql',
documents: 'src/graphql/queries/*.graphql',
generates: {
'src/graphql/schema-public.graphql': {
plugins: [
// https://the-guild.dev/graphql/codegen/plugins/other/schema-ast
'schema-ast',
// https://the-guild.dev/graphql/codegen/plugins/other/add
{
add: {
content: [
`
# SPDX-FileCopyrightText: 2023 Zextras <https://www.zextras.com>
#
# SPDX-License-Identifier: AGPL-3.0-only
`,
'" THIS FILE IS AUTOGENERATED BY GRAPHQL-CODEGEN. DO NOT EDIT! "'
]
}
}
]
},
'src/graphql/types.ts': {
plugins: [
// https://the-guild.dev/graphql/codegen/plugins/typescript/typescript
'typescript',
// https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-operations
'typescript-operations',
'typed-document-node',
// https://the-guild.dev/graphql/codegen/plugins/other/add
{
add: {
content: ['// THIS FILE IS AUTOGENERATED BY GRAPHQL-CODEGEN. DO NOT EDIT!']
}
}
],
config: {
typesPrefix: 'GQL',
defaultScalarType: 'unknown',
exportFragmentSpreadSubTypes: true,
mergeFragmentTypes: true,
nonOptionalTypename: true,
scalars: {
DateTime: 'number'
},
strictScalars: true,
useTypeImports: true
} satisfies TypeScriptPluginConfig &
TypeScriptDocumentsPluginConfig &
TypeScriptTypedDocumentNodesConfig
},
'src/graphql/schema-public.ts': {
plugins: [
'src/graphql/plugin/schemaGenerator.cjs',
// https://the-guild.dev/graphql/codegen/plugins/other/add
{
add: {
content: ['// THIS FILE IS AUTOGENERATED BY GRAPHQL-CODEGEN. DO NOT EDIT!']
}
}
]
}
},
hooks: {
afterAllFileWrite:
'eslint --fix --resolve-plugins-relative-to node_modules/@zextras/carbonio-ui-configs src/graphql/types.ts'
}
};
export default config;