From 158d3baf862e18f9b323b3dcd2c36902fe9680ff Mon Sep 17 00:00:00 2001 From: JMV Trinidad Date: Mon, 26 Sep 2022 21:06:07 +0400 Subject: [PATCH] feat: support for v2 of graphql codegen --- package.json | 12 ++++++------ .../runtime-config-helpers/getCodegenConfig.js | 9 ++++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 9e7ef0a..497e588 100644 --- a/package.json +++ b/package.json @@ -8,16 +8,16 @@ }, "bugs": "https://github.com/xolvio/chimp/issues", "dependencies": { - "@graphql-tools/graphql-file-loader": "^6.2.5", - "@graphql-tools/load": "^6.2.5", - "@graphql-tools/merge": "^6.2.5", + "@graphql-tools/graphql-file-loader": "^7.5.5", + "@graphql-tools/load": "^7.7.7", + "@graphql-tools/merge": "^8.3.6", "@oclif/command": "^1", "@oclif/config": "^1", "@oclif/plugin-help": "^3", "debug": "^4.3.1", "enquirer": "^2.3.6", "find-package-json": "^1.2.0", - "graphql": "15.5.1", + "graphql": "16.6.0", "graphql-tag": "^2.10.3", "handlebars": "^4.0.12", "listr2": "3.3.3", @@ -33,7 +33,7 @@ "@types/node": "^14.14.22", "chai": "^4.2.0", "copyfiles": "^2.4.1", - "eslint": "^5.13", + "eslint": "^7.32.0", "eslint-config-oclif": "^3.1", "eslint-config-oclif-typescript": "^0.1", "eslint-config-prettier": "^7.2.0", @@ -47,7 +47,7 @@ "testdouble-jest": "^2.0.0", "ts-jest": "^26.4.4", "ts-node": "^8", - "typescript": "^3.3", + "typescript": "4.4.4", "wait-on": "^5.2.1" }, "engines": { diff --git a/src/generate/runtime-config-helpers/getCodegenConfig.js b/src/generate/runtime-config-helpers/getCodegenConfig.js index cf71dcd..a3c9085 100644 --- a/src/generate/runtime-config-helpers/getCodegenConfig.js +++ b/src/generate/runtime-config-helpers/getCodegenConfig.js @@ -59,6 +59,7 @@ module.exports = function ({ contextType } = {}) { objectIdType: 'string', federation: true, mappers, + makeResolverTypeCallable: true, scalars: { Upload: 'Promise', }, @@ -68,16 +69,18 @@ module.exports = function ({ contextType } = {}) { 'typescript-resolvers', 'typescript-operations', 'chimp-graphql-codegen-plugin', - { add: 'export {GqlContext};' }, + { add: { content: 'export {GqlContext};'} }, { - add: ` + add: { + content: ` import { ReadStream } from "fs-capacitor"; interface GraphQLFileUpload { filename: string; mimetype: string; encoding: string; createReadStream(options?:{encoding?: string, highWaterMark?: number}): ReadStream; -}`, +}` + }, }, ], },