-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodegen.ts
49 lines (45 loc) · 1.27 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
import type { CodegenConfig } from '@graphql-codegen/cli';
const SERVER: string = process.env.GQL_SERVER!;
const SECRET: string = process.env.GQL_SERVER_ADMIN_SECRET!;
console.log('SERVER', SERVER);
console.log('SECRET', SECRET);
const config: CodegenConfig = {
overwrite: true,
emitLegacyCommonJSImports: false,
schema: [
{
[SERVER]: {
headers: {
'x-hasura-admin-secret': SECRET,
},
},
},
],
documents: 'apollo/queries/*.graphql',
generates: {
'./apollo/client.ts': {
// preset: 'client',
plugins: [
{ add: { content: '// THIS FILE IS GENERATED, DO NOT EDIT!' } },
{ add: { content: '/* tslint:disable */' } },
{ add: { content: '/* eslint-disable */' } },
{ add: { content: '// @ts-nocheck' } },
'typescript',
'typescript-operations',
'typescript-vue-apollo',
'typescript-apollo-client-helpers',
'named-operations-object',
],
config: {
enumsAsTypes: true,
withCompositionFunctions: true,
vueApolloComposableImportFrom: '@vue/apollo-composable',
vueCompositionApiImportFrom: 'vue',
},
},
'./apollo/graphql.schema.json': {
plugins: ['introspection'],
},
},
};
export default config;