-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodegen.ts
31 lines (29 loc) · 1.06 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
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
overwrite: true,
schema: 'http://localhost:8080/graphql',
// watch: true, // This doesn't seem to work.
// Because I'm using bun --watch to run the app. When a change is detected, bun restarts the entire app and makes the graphql server temporarily unavailable, which results in type generation failure. Can't find a way to delay regeneration to avoid this.
// watch: 'src/**/*.ts',
// hooks: {
// onWatchTriggered: async () => {
// console.log('---------onWatchTriggered');
// await new Promise((resolve) => setTimeout(resolve, 3000));
// console.log('---------onWatchTriggered done');
// },
// },
emitLegacyCommonJSImports: false,
generates: {
'src/generated/graphql.ts': {
plugins: ['typescript', 'typescript-resolvers'],
config: {
skipTypename: true,
contextType: '../resolvers/index.js#ResolverContext',
scalars: {
DateTime: 'Date',
},
},
},
},
};
export default config;