-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathcodegen.ts
More file actions
43 lines (38 loc) · 1.06 KB
/
Copy pathcodegen.ts
File metadata and controls
43 lines (38 loc) · 1.06 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
// SPDX-License-Identifier: AGPL-3.0-or-later
import type { CodegenConfig } from '@graphql-codegen/cli'
const scalars = {
UUID: 'string',
DateTime: 'string',
Date: 'string',
Upload: 'File',
}
/**
* Builds the client preset output for one package's documents.
* @param root - The package directory holding the documents.
* @returns The generates entry writing that package's gql module.
*/
function clientPreset(root: string) {
return {
[`${root}/gql/`]: {
preset: 'client' as const,
presetConfig: { fragmentMasking: false },
documents: [
`${root}/**/*.{ts,tsx}`,
`!${root}/gql/**`,
`!${root}/node_modules/**`,
],
config: { useTypeImports: true, scalars },
},
}
}
const config: CodegenConfig = {
schema: ['graph/schema/*.graphqls', 'plugins/*/graph/*.graphqls', 'enterprise/*/graph/*.graphqls'],
generates: {
...clientPreset('frontend/src'),
...clientPreset('plugins/whatsapp/frontend'),
...clientPreset('plugins/importer/frontend'),
...clientPreset('plugins/fields/frontend'),
},
ignoreNoDocuments: true,
}
export default config