Skip to content

Commit bec429a

Browse files
committed
refactor(api): graphql codegen
Signed-off-by: Adam Setch <adam.setch@outlook.com>
1 parent e7a7716 commit bec429a

5 files changed

Lines changed: 1614 additions & 29449 deletions

File tree

codegen.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,15 @@ const config: CodegenConfig = {
1515
},
1616
documents: ['src/renderer/utils/api/**/*.graphql'],
1717
generates: {
18-
'src/renderer/utils/api/graphql/generated/': {
19-
preset: 'client',
20-
presetConfig: {
21-
fragmentMasking: false, // Disables masking
22-
},
18+
'src/renderer/utils/api/graphql/generated/graphql.ts': {
19+
plugins: ['typescript', 'typescript-operations', 'typed-document-node'],
2320
config: {
21+
onlyOperationTypes: true,
2422
documentMode: 'string',
25-
enumsAsTypes: true,
2623
useTypeImports: true,
27-
},
28-
},
29-
'src/renderer/utils/api/graphql/generated/schema.graphql': {
30-
plugins: ['schema-ast'],
31-
config: {
32-
includeDirectives: true,
24+
enumsAsTypes: true,
25+
skipTypename: true,
26+
fragmentMasking: false, // Disables masking
3327
},
3428
},
3529
},

graphql.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { IGraphQLConfig } from 'graphql-config';
22

33
const config: IGraphQLConfig = {
44
schema: './src/renderer/utils/api/graphql/generated/schema.graphql',
5+
documents: ['src/renderer/utils/api/**/*.graphql'],
56
};
67

78
export default config;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"@electron/notarize": "3.1.1",
8787
"@graphql-codegen/cli": "6.1.1",
8888
"@graphql-codegen/schema-ast": "5.0.0",
89+
"@graphql-typed-document-node/core": "3.2.0",
8990
"@octokit/core": "7.0.6",
9091
"@octokit/graphql": "9.0.3",
9192
"@octokit/oauth-methods": "6.0.2",
@@ -157,4 +158,4 @@
157158
"*": "biome check --no-errors-on-unmatched",
158159
"*.{js,ts,tsx}": "pnpm test --changed --passWithNoTests --update"
159160
}
160-
}
161+
}

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)