-
Notifications
You must be signed in to change notification settings - Fork 1
/
codegen.ts
38 lines (33 loc) · 1000 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
36
37
38
import type { CodegenConfig } from "@graphql-codegen/cli";
import { addTypenameSelectionDocumentTransform } from "@graphql-codegen/client-preset";
import { NhostClient } from "@nhost/vue";
import * as dotenv from "dotenv";
dotenv.config();
const nhost = new NhostClient({
subdomain: process.env.NUXT_PUBLIC_NHOST_SUBDOMAIN,
region: process.env.NUXT_PUBLIC_NHOST_REGION,
});
const config: CodegenConfig = {
schema: {
[nhost.graphql.httpUrl]: {
headers: {
"x-hasura-admin-secret": process.env.NUXT_HASURA_SECRET!,
},
},
},
documents: ["pages/**/*.vue", "components/**/*.vue", "layouts/**/*.vue"],
ignoreNoDocuments: true, // for better experience with the watcher
generates: {
"./gql/": {
preset: "client",
config: {
useTypeImports: true,
},
documentTransforms: [addTypenameSelectionDocumentTransform],
},
"./gql/introspection.ts": {
plugins: ["urql-introspection"],
},
},
};
export default config;