-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathcodegen.ts
More file actions
47 lines (45 loc) · 1.78 KB
/
Copy pathcodegen.ts
File metadata and controls
47 lines (45 loc) · 1.78 KB
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
import type { CodegenConfig } from "@graphql-codegen/cli"
const config: CodegenConfig = {
// For the moment, we use a schema dumped by scripts/dump-schema.ts.
// If we can make it work in the future, we may be able to point directly
// at packages/openneuro-server/src/graphql/schema.ts, or import and pass
// the generated text.
// pnp seems to be the sticking point here, and I've given up for now.
schema: "schema.graphql",
documents: [
"packages/openneuro-app/src/**/*.{ts,tsx}",
"!packages/openneuro-app/src/gql/**",
// Exclude files with duplicate operation names.
// These must be deduplicated before they can be included.
// Cross-file duplicates:
"!packages/openneuro-app/src/scripts/datalad/mutations/snapshot.tsx",
"!packages/openneuro-app/src/scripts/dataset/mutations/snapshot.tsx",
"!packages/openneuro-app/src/scripts/dataset/download/download-script.tsx",
"!packages/openneuro-app/src/scripts/dataset/snapshot-container.tsx",
"!packages/openneuro-app/src/scripts/search/use-search-results.tsx",
// Intra-file duplicates (two operations share a name):
"!packages/openneuro-app/src/scripts/queries/dataset.ts",
// Type mismatches (nullable list items vs non-nullable schema):
"!packages/openneuro-app/src/scripts/dataset/files/files.tsx",
],
generates: {
"packages/openneuro-app/src/gql/": {
preset: "client",
presetConfig: { fragmentMasking: false },
config: {
scalars: {
Date: "string",
DateTime: "string",
BigInt: "number",
JSON: "unknown",
},
useTypeImports: true,
avoidOptionals: { field: false, inputValue: false, object: false },
},
},
},
hooks: {
afterAllFileWrite: ["deno fmt"],
},
}
export default config