-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
37 lines (34 loc) · 1.08 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
import {CodegenConfig} from '@graphql-codegen/cli';
const drupalUrl = `${process.env.NEXT_PUBLIC_DRUPAL_BASE_URL}/graphql`;
const config: CodegenConfig = {
overwrite: true,
schema: [{
[drupalUrl]: {
headers: {
"Authorization": "Basic " + Buffer.from(process.env.DRUPAL_BASIC_AUTH || process.env.DRUPAL_BASIC_AUTH_ADMIN as string).toString("base64")
}
}
}],
documents: 'src/lib/gql/*.drupal.gql',
generates: {
'src/lib/gql/__generated__/drupal.d.tsx': {
plugins: [
'typescript',
'typescript-operations',
{add: {content: "/** THIS IS GENERATED FILE. DO NOT MODIFY IT DIRECTLY, RUN 'yarn graphql' INSTEAD. **/"}}
],
},
'src/lib/gql/__generated__/queries.ts': {
preset: 'import-types',
plugins: [
'typescript-graphql-request',
{add: {content: "/** THIS IS GENERATED FILE. DO NOT MODIFY IT DIRECTLY, RUN 'yarn graphql' INSTEAD. **/"}}
],
presetConfig: {
typesPath: './drupal.d',
importTypesNamespace: 'DrupalTypes'
},
},
},
};
export default config;