forked from vendure-ecommerce/storefront-qwik-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodegen-shop.ts
32 lines (28 loc) · 845 Bytes
/
codegen-shop.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
import type { CodegenConfig } from '@graphql-codegen/cli';
import { DEV_API, LOCAL_API, PROD_API } from './src/constants';
let GRAPHQL_API = import.meta.env.IS_DEV
? DEV_API
: import.meta.env.IS_LOCAL
? LOCAL_API
: PROD_API;
GRAPHQL_API = `${GRAPHQL_API}/shop-api`;
const config: CodegenConfig = {
schema: [
GRAPHQL_API,
'type Mutation { createStripePaymentIntent: String }',
'type Query { generateBraintreeClientToken(orderId: ID, includeCustomerId: Boolean): String }',
],
documents: ['"src/providers/shop/**/*.{ts,tsx}"', '!src/generated/*'],
generates: {
'src/generated/graphql-shop.ts': {
config: {
enumsAsConst: true,
},
plugins: ['typescript', 'typescript-operations', 'typescript-generic-sdk'],
},
'src/generated/schema-shop.graphql': {
plugins: ['schema-ast'],
},
},
};
export default config;