From 75be56fed7c9e6e781a557bacc9621ef82f6f843 Mon Sep 17 00:00:00 2001 From: U-ya <52757302+u-yas@users.noreply.github.com> Date: Mon, 7 Feb 2022 02:20:55 +0900 Subject: [PATCH] [with-typescript-graphql] fixes breaking changes in graphql-let v0.18.0 (#32681) * Migrate graphql-let v0.18.0 according to the documentation * lint-fix Co-authored-by: JJ Kasper --- examples/with-typescript-graphql/.gitignore | 1 + examples/with-typescript-graphql/.graphql-let.yml | 2 +- examples/with-typescript-graphql/lib/resolvers.ts | 2 +- examples/with-typescript-graphql/package.json | 6 +++--- examples/with-typescript-graphql/tsconfig.json | 11 +++++++++-- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/examples/with-typescript-graphql/.gitignore b/examples/with-typescript-graphql/.gitignore index 4b107f299be6b..d3dd34733a8bc 100644 --- a/examples/with-typescript-graphql/.gitignore +++ b/examples/with-typescript-graphql/.gitignore @@ -37,3 +37,4 @@ yarn-error.log* __generated__ *.graphql.d.ts *.graphqls.d.ts +.cache diff --git a/examples/with-typescript-graphql/.graphql-let.yml b/examples/with-typescript-graphql/.graphql-let.yml index c820c15cb4da5..223562044eaf6 100644 --- a/examples/with-typescript-graphql/.graphql-let.yml +++ b/examples/with-typescript-graphql/.graphql-let.yml @@ -3,4 +3,4 @@ documents: '**/*.graphql' plugins: - typescript-operations - typescript-react-apollo -cacheDir: __generated__ +cacheDir: .cache diff --git a/examples/with-typescript-graphql/lib/resolvers.ts b/examples/with-typescript-graphql/lib/resolvers.ts index c64891aa1b5e9..e2125756018c6 100644 --- a/examples/with-typescript-graphql/lib/resolvers.ts +++ b/examples/with-typescript-graphql/lib/resolvers.ts @@ -1,4 +1,4 @@ -import { QueryResolvers, MutationResolvers } from './type-defs.graphqls' +import { QueryResolvers, MutationResolvers } from '@graphql-types@' import { ResolverContext } from './apollo' const userProfile = { diff --git a/examples/with-typescript-graphql/package.json b/examples/with-typescript-graphql/package.json index 805c18b685165..72413abcba029 100644 --- a/examples/with-typescript-graphql/package.json +++ b/examples/with-typescript-graphql/package.json @@ -20,7 +20,7 @@ }, "devDependencies": { "@graphql-codegen/cli": "^1.17.8", - "@graphql-codegen/import-types-preset": "1.18.2", + "@graphql-codegen/import-types-preset": "^2.1.8", "@graphql-codegen/plugin-helpers": "^1.17.8", "@graphql-codegen/typescript": "^1.17.8", "@graphql-codegen/typescript-operations": "^1.17.8", @@ -30,11 +30,11 @@ "@types/react-dom": "^16.9.8", "@types/react-test-renderer": "^17.0.1", "babel-jest": "26.3.0", - "graphql-let": "0.x", + "graphql-let": "^0.18.6", "graphql-tag": "2.11.0", "jest": "26.4.0", "react-test-renderer": "^17.0.1", - "typescript": "^3.9.7", + "typescript": "^4.5.4", "yaml-loader": "0.6.0" } } diff --git a/examples/with-typescript-graphql/tsconfig.json b/examples/with-typescript-graphql/tsconfig.json index d903e6e706d5a..56bcf4a2f3105 100644 --- a/examples/with-typescript-graphql/tsconfig.json +++ b/examples/with-typescript-graphql/tsconfig.json @@ -12,8 +12,15 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "preserve" + "jsx": "preserve", + "baseUrl": ".", + "paths": { + "@graphql-types@": [ + "node_modules/@types/graphql-let/__generated__/__types__" + ] + }, + "incremental": true }, "include": ["next-env.d.ts", "graphql.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] + "exclude": ["node_modules", ".cache"] }