-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
30 lines (26 loc) · 829 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
import type { CodegenConfig } from "@graphql-codegen/cli"
const schemaUrlByMode = {
development: "http://localhost:3080/graphql",
production: "https://personal-app-backend.onrender.com/graphql"
}
const mode = (process.env.MODE as "development" | "production" | undefined) ?? "development"
const config: CodegenConfig = {
documents: "./src/api/**/*.graphql",
generates: {
"src/api/types.generated.ts": {
plugins: ["typescript"],
},
"src/api": {
preset: "near-operation-file",
presetConfig: {
extension: ".generated.ts",
baseTypesPath: "types.generated.ts",
},
plugins: ["typescript-operations", "typescript-react-apollo"],
},
},
overwrite: true,
schema: schemaUrlByMode[mode],
}
// eslint-disable-next-line no-restricted-syntax
export default config