From cb1f93618b3c92cd092b740973d2469c232c2c00 Mon Sep 17 00:00:00 2001 From: Charly POLY <1252066+charlypoly@users.noreply.github.com> Date: Thu, 6 Oct 2022 14:06:05 +0200 Subject: [PATCH] TS config file loading issue (#8452) Co-authored-by: github-actions[bot] --- .../@graphql-codegen_cli-8452-dependencies.md | 5 +++++ .changeset/modern-rabbits-rescue.md | 5 +++++ packages/graphql-codegen-cli/package.json | 2 +- packages/graphql-codegen-cli/src/config.ts | 5 ++++- yarn.lock | 15 +++++---------- 5 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 .changeset/@graphql-codegen_cli-8452-dependencies.md create mode 100644 .changeset/modern-rabbits-rescue.md diff --git a/.changeset/@graphql-codegen_cli-8452-dependencies.md b/.changeset/@graphql-codegen_cli-8452-dependencies.md new file mode 100644 index 00000000000..859ea95682c --- /dev/null +++ b/.changeset/@graphql-codegen_cli-8452-dependencies.md @@ -0,0 +1,5 @@ +--- +"@graphql-codegen/cli": patch +--- +dependencies updates: + - Updated dependency [`graphql-config@4.3.6` ↗︎](https://www.npmjs.com/package/graphql-config/v/4.3.6) (from `^4.3.5`, in `dependencies`) diff --git a/.changeset/modern-rabbits-rescue.md b/.changeset/modern-rabbits-rescue.md new file mode 100644 index 00000000000..da9da903482 --- /dev/null +++ b/.changeset/modern-rabbits-rescue.md @@ -0,0 +1,5 @@ +--- +'@graphql-codegen/cli': patch +--- + +conflict with `graphql-config` also using TypeScriptLoader(), causing a double `ts-node` register. diff --git a/packages/graphql-codegen-cli/package.json b/packages/graphql-codegen-cli/package.json index cd93930a512..9cbffe6f398 100644 --- a/packages/graphql-codegen-cli/package.json +++ b/packages/graphql-codegen-cli/package.json @@ -63,7 +63,7 @@ "cosmiconfig-typescript-loader": "4.1.1", "debounce": "^1.2.0", "detect-indent": "^6.0.0", - "graphql-config": "^4.3.5", + "graphql-config": "4.3.6", "inquirer": "^8.0.0", "is-glob": "^4.0.1", "json-to-pretty-yaml": "^1.2.2", diff --git a/packages/graphql-codegen-cli/src/config.ts b/packages/graphql-codegen-cli/src/config.ts index a3d796331f4..0657e075c4e 100644 --- a/packages/graphql-codegen-cli/src/config.ts +++ b/packages/graphql-codegen-cli/src/config.ts @@ -22,6 +22,9 @@ import { createHash } from 'crypto'; const { lstat } = promises; +// #8437: conflict with `graphql-config` also using TypeScriptLoader(), causing a double `ts-node` register. +const tsLoader = TypeScriptLoader({ transpileOnly: true }); + export type CodegenConfig = Types.Config; export type YamlCliFlags = { @@ -75,7 +78,7 @@ function customLoader(ext: 'json' | 'yaml' | 'js' | 'ts') { } if (ext === 'ts') { - return TypeScriptLoader()(filepath, content); + return tsLoader(filepath, content); } } diff --git a/yarn.lock b/yarn.lock index c9e90b3efc0..dbf0f4f6864 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5171,16 +5171,11 @@ cosmiconfig-toml-loader@1.0.0: dependencies: "@iarna/toml" "^2.2.5" -cosmiconfig-typescript-loader@4.1.1: +cosmiconfig-typescript-loader@4.1.1, cosmiconfig-typescript-loader@^4.0.0: version "4.1.1" resolved "https://registry.yarnpkg.com/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-4.1.1.tgz#38dd3578344038dae40fdf09792bc2e9df529f78" integrity sha512-9DHpa379Gp0o0Zefii35fcmuuin6q92FnLDffzdZ0l9tVd3nEobG3O+MZ06+kuBvFTSVScvNb/oHA13Nd4iipg== -cosmiconfig-typescript-loader@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-4.0.0.tgz#4a6d856c1281135197346a6f64dfa73a9cd9fefa" - integrity sha512-cVpucSc2Tf+VPwCCR7SZzmQTQkPbkk4O01yXsYqXBIbjE1bhwqSyAgYQkRK1un4i0OPziTleqFhdkmOc4RQ/9g== - cosmiconfig@7.0.1, cosmiconfig@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.1.tgz#714d756522cace867867ccb4474c5d01bbae5d6d" @@ -7573,10 +7568,10 @@ graphlib@^2.1.8: dependencies: lodash "^4.17.15" -graphql-config@^4.1.0, graphql-config@^4.3.5: - version "4.3.5" - resolved "https://registry.yarnpkg.com/graphql-config/-/graphql-config-4.3.5.tgz#bd197ec9c1e86d2696c61332be35b920ba7be700" - integrity sha512-B4jXhHL7j3llCem+ACeo48wvVYhtJxRyt5SfSnvywbRlVYyUzt5ibZV6WJU2Yii2/rcVRIGi7BHDgcAPWdWdJg== +graphql-config@4.3.6, graphql-config@^4.1.0: + version "4.3.6" + resolved "https://registry.yarnpkg.com/graphql-config/-/graphql-config-4.3.6.tgz#908ef03d6670c3068e51fe2e84e10e3e0af220b6" + integrity sha512-i7mAPwc0LAZPnYu2bI8B6yXU5820Wy/ArvmOseDLZIu0OU1UTULEuexHo6ZcHXeT9NvGGaUPQZm8NV3z79YydA== dependencies: "@graphql-tools/graphql-file-loader" "^7.3.7" "@graphql-tools/json-file-loader" "^7.3.7"