-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcodegen.ts
58 lines (55 loc) · 1.56 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
import type { CodegenConfig } from "@graphql-codegen/cli"
import { UUIDDefinition } from "graphql-scalars"
const basePlugins = [
{
add: {
content: [
"// This file was generated by graphql-codegen. DO NOTT EDIT MANUALLY.",
"// biome-ignore lint: This file was generated by graphql-codegen.",
],
},
},
]
const config: CodegenConfig = {
schema: [UUIDDefinition, "./src/module/**/schema.graphql"],
overwrite: true,
emitLegacyCommonJSImports: false,
generates: {
"./src/module/": {
preset: "graphql-modules",
presetConfig: {
useGraphQLModules: false,
baseTypesPath: "./common/types/graphql.ts",
importBaseTypesFrom: "../../common/types/graphql.ts",
filename: "types/graphql.ts",
requireRootResolvers: true,
},
config: {
scalars: {
UUID: "string",
},
strictScalars: true,
useTypeImports: true,
namingConvention: {
transformUnderscore: true,
},
typesPrefix: "Gql",
enumsAsTypes: true,
contextType: "../../../server/apollo/context.js#GraphQLContext",
useIndexSignature: true,
mappers: {
Account: "../../account/model/index.js#Account",
Organization: "../../organization/model/index.js#Organization",
},
},
plugins: ["typescript", "typescript-resolvers", ...basePlugins],
},
"./docs/graphql/src/introspection.json": {
plugins: ["introspection"],
config: {
minify: true,
},
},
},
}
export default config