-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcodegen.ts
More file actions
39 lines (36 loc) · 983 Bytes
/
codegen.ts
File metadata and controls
39 lines (36 loc) · 983 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
import type { CodegenConfig } from "@graphql-codegen/cli";
const schemaUrl = new URL("/api", process.env.PRISMATIC_URL).toString();
const config: CodegenConfig = {
overwrite: true,
emitLegacyCommonJSImports: false,
schema: [
{
[schemaUrl]: {
headers: {
Authorization: `Bearer ${process.env.GRAPHQL_AUTH_KEY}`,
"Prismatic-Docs-Introspection": "true",
},
},
},
],
documents: ["src/graphql/**/*.graphql"],
generates: {
// Base schema types (enums, scalars, input types)
"src/graphql/schema.generated.ts": {
plugins: ["typescript"],
config: {
onlyOperationTypes: true,
},
},
// Operation types co-located with query files
"src/graphql/": {
preset: "near-operation-file",
presetConfig: {
extension: ".generated.ts",
baseTypesPath: "schema.generated.js",
},
plugins: ["typescript-operations"],
},
},
};
export default config;