-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
37 lines (35 loc) · 861 Bytes
/
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
import { type CodegenConfig } from "@graphql-codegen/cli";
const config = {
schema: "http://localhost:3000/api/graphql",
overwrite: true,
documents: ["apps/web/src/**/*.gql"],
generates: {
"./apps/web/graphql.schema.json": {
plugins: ["introspection"],
config: {
minify: true,
},
},
"./packages/shared/generated/graphql.ts": {
plugins: [
{
add: {
content:
'import type { DocumentNode } from "graphql/language/ast";',
},
},
"typescript",
"typescript-operations",
"typescript-graphql-request",
],
config: {
avoidOptionals: true,
useTypeImports: true,
},
hooks: {
afterOneFileWrite: ["prettier --write"],
},
},
},
} satisfies CodegenConfig;
export default config;