-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodegen.ts
35 lines (32 loc) · 850 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
import { CodegenConfig } from "@graphql-codegen/cli";
import { configDotenv } from "dotenv";
import path from "path/posix";
const env = configDotenv({
path: path.resolve(__dirname, ".env.local"),
});
const config: CodegenConfig = {
schema: [
{
"https://api.stratz.com/graphql": {
headers: {
Authorization: `Bearer ${
env.parsed?.STRAZT_API_KEY || process.env.STRAZT_API_KEY
}`,
},
},
},
],
// this assumes that all your source files are in a top-level `src/` directory - you might need to adjust this to your file structure
documents: ["src/**/*.{ts,tsx}"],
generates: {
"./src/__generated__/": {
preset: "client",
plugins: [],
presetConfig: {
gqlTagName: "gql",
},
},
},
ignoreNoDocuments: true,
};
export default config;