-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.ts
More file actions
37 lines (34 loc) · 855 Bytes
/
codegen.ts
File metadata and controls
37 lines (34 loc) · 855 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
import type { CodegenConfig } from "@graphql-codegen/cli";
import { pascalCase } from "change-case-all";
let isExperiments = false;
const config: CodegenConfig = {
overwrite: true,
schema: "http://localhost:34583/graphql",
documents: ["src/**/*.graphql.ts"],
config: {
// Super hacky way to retain the experiments as is
namingConvention: (str: string) => {
if (str === "ACCOUNT_DEV_ELIGIBLE") {
isExperiments = true;
}
if (isExperiments) {
if (str === "ZZ_TEST") isExperiments = false;
return str;
}
if (!str) return str;
return pascalCase(str);
}
},
generates: {
"./graphql.schema.json": {
plugins: ["introspection"]
},
"./src/gql/": {
preset: "client",
config: {
useTypeImports: true
}
}
}
};
export default config;