File size: 882 Bytes
84c1942
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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`,
    `./src/**/subscriptions.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`],
    },
  },
};