From 9c27e72f6d8c47bc3d23047980a15db4c80e0d32 Mon Sep 17 00:00:00 2001 From: David D Date: Fri, 21 Apr 2023 12:45:22 -0600 Subject: [PATCH 1/2] Handle non-src dirs for TypeScript documents --- docs/source/development-testing/static-typing.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/development-testing/static-typing.md b/docs/source/development-testing/static-typing.md index 0176fcef988..714db5646bc 100644 --- a/docs/source/development-testing/static-typing.md +++ b/docs/source/development-testing/static-typing.md @@ -44,6 +44,8 @@ export default config; > There are multiple ways to [specify a schema](https://www.the-guild.dev/graphql/codegen/docs/config-reference/schema-field#root-level) in your `codegen.ts`, so pick whichever way works best for your project setup. +> Your `documents` might exist in directories other than `src` and may include `ts` files, please adjust accordingly. To catch everything, consider implementing: `documents: ['**/*.{ts,tsx}']`. + Finally, we'll add the following scripts to our `package.json` file: ```json title="package.json" From 9aae77b179dd43aedace53956a49b2caf9d7a987 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Thu, 14 Sep 2023 16:43:40 +0200 Subject: [PATCH 2/2] apply suggestion --- docs/source/development-testing/static-typing.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/source/development-testing/static-typing.md b/docs/source/development-testing/static-typing.md index 714db5646bc..c08fdee5f3f 100644 --- a/docs/source/development-testing/static-typing.md +++ b/docs/source/development-testing/static-typing.md @@ -26,7 +26,8 @@ import { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: '', - documents: ['src/**/*.tsx'], + // this assumes that all your source files are in a top-level `src/` directory - you might need to adjust this to your file structure + documents: ['src/**/*.{ts,tsx}'], generates: { './src/__generated__/': { preset: 'client', @@ -44,8 +45,6 @@ export default config; > There are multiple ways to [specify a schema](https://www.the-guild.dev/graphql/codegen/docs/config-reference/schema-field#root-level) in your `codegen.ts`, so pick whichever way works best for your project setup. -> Your `documents` might exist in directories other than `src` and may include `ts` files, please adjust accordingly. To catch everything, consider implementing: `documents: ['**/*.{ts,tsx}']`. - Finally, we'll add the following scripts to our `package.json` file: ```json title="package.json"