-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathcodegen.ts
More file actions
40 lines (37 loc) · 986 Bytes
/
codegen.ts
File metadata and controls
40 lines (37 loc) · 986 Bytes
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
import dotenv from "dotenv";
import path from "path";
import type { CodegenConfig } from "@graphql-codegen/cli";
dotenv.config({
path: path.resolve(process.cwd(), ".env.local"),
});
dotenv.config({
path: path.resolve(process.cwd(), ".env"),
});
const config: CodegenConfig = {
schema: [
{
[process.env.REACT_APP_HASURA_DEV_HTTPLINK!]: {
headers: {
"x-hasura-admin-secret": process.env.HASURA_GRAPHQL_ADMIN_SECRET!,
},
},
},
],
documents: ["./src/graphql/**/*.graphql"],
generates: {
"./src/generated/graphql.tsx": {
plugins: [
"typescript",
"typescript-operations",
"typescript-react-apollo",
],
config: {
// Keep legacy-compatible scalar behavior and avoid `unknown` widening.
defaultScalarType: "any",
// Preserve schema operation references instead of inlining every type.
preResolveTypes: false,
},
},
},
};
export default config;