forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.js
More file actions
41 lines (36 loc) · 849 Bytes
/
codegen.js
File metadata and controls
41 lines (36 loc) · 849 Bytes
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
const isStaging = process.argv.includes('--staging');
const isDev = process.argv.includes('--dev');
const host = (() => {
if (isDev) {
return 'http://server:4000';
}
if (isStaging) {
return 'https://codesandbox.stream';
}
return 'https://codesandbox.io';
})();
const URL = `${host}/api/graphql`;
module.exports = {
schema: URL,
documents: [
`./src/**/*.gql`,
`./src/app/overmind/effects/gql/**/*.ts`,
`./src/**/queries.ts`,
`./src/**/mutations.ts`,
],
overwrite: true,
hooks: {
afterAllFileWrite: [`prettier --write`],
},
generates: {
'./src/app/graphql/types.ts': {
plugins: [`typescript`, `typescript-operations`],
config: {
avoidOptionals: true,
},
},
'./src/app/graphql/introspection-result.ts': {
plugins: [`fragment-matcher`],
},
},
};