generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 3
/
codegen.ts
48 lines (44 loc) · 1.12 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
import path from 'path'
import { schema } from '@octokit/graphql-schema'
import { CodegenConfig } from '@graphql-codegen/cli'
const config: CodegenConfig = {
schema: schema.idl,
documents: '**/*.ts',
emitLegacyCommonJSImports: false,
generates: {
'/': {
preset: 'near-operation-file',
presetConfig: {
baseTypesPath: path.join(process.cwd(), 'src', 'base-graphql-types.ts'),
extension: '.graphql.ts',
folder: '__generated__',
},
plugins: [
{
add: {
content: `/* eslint-disable */
/**
* This file is generated, don’t edit it manually. Run \`bun generate\` to re-generate.
*/
`,
},
},
{
'typescript-operations': {
enumsAsTypes: true,
immutableTypes: true,
avoidOptionals: true,
skipTypename: true,
scalars: {
DateTime: 'string',
},
},
},
],
hooks: {
afterOneFileWrite: 'prettier --write',
},
},
},
}
export default config