-
Notifications
You must be signed in to change notification settings - Fork 0
/
codegen.ts
30 lines (28 loc) · 829 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
import type { CodegenConfig } from '@graphql-codegen/cli'
import 'dotenv/config'
const IS_DEV = process.env.APP_ENV === 'dev'
const config: CodegenConfig = {
schema: IS_DEV? process.env.PUBLIC_SHOPAPI_DEV_URL: process.env.PUBLIC_SHOPAPI_PROD_URL,
// watch: true,
// documents: ['src/**/*.{ts,svelte,graphql.ts}', '!src/lib/gql/*'],
documents: ['src/**/*.{ts,svelte,graphql.ts}', '!src/lib/gql/*'],
ignoreNoDocuments: true,
generates: {
'src/lib/gql/': {
preset: 'client',
presetConfig: {
gqlTagName: 'gql',
// fragmentMasking: false,
},
plugins: ['typescript'],
config: {
useTypeImports: true, // This is needed to avoid Vite/SvelteKit import errors
scalars: {
// This tells codegen that the `Money` scalar is a number
Money: 'number',
}
}
},
}
}
export default config