-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathcodegen.ts
33 lines (32 loc) · 1021 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
import type { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
schema: "https://raw.githubusercontent.com/saleor/saleor/main/saleor/graphql/schema.graphql",
documents: [], // No need to search for documents, we are only generating enums
ignoreNoDocuments: true, // Prevents throwing error on generating types in project without typed queries
generates: {
"./src/generated-enums.ts": {
plugins: [
"typescript",
{
add: {
content: [
"/**",
" * Generated file, do not modify it by hand.",
" * To update it to the current schema, use `pnpm generate` script.",
" */",
],
},
},
],
config: {
onlyEnums: true,
enumsAsTypes: true,
typesPrefix: "Generated", // Added the prefix since we export only subset of all enums
},
},
},
hooks: {
afterAllFileWrite: "prettier --write",
},
};
export default config;