Skip to content

Commit

Permalink
TS config file loading issue (#8452)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
charlypoly and github-actions[bot] authored Oct 6, 2022
1 parent 2999ca0 commit cb1f936
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/@graphql-codegen_cli-8452-dependencies.md
Original file line number Diff line number Diff line change
@@ -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`)
5 changes: 5 additions & 0 deletions .changeset/modern-rabbits-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-codegen/cli': patch
---

conflict with `graphql-config` also using TypeScriptLoader(), causing a double `ts-node` register.
2 changes: 1 addition & 1 deletion packages/graphql-codegen-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion packages/graphql-codegen-cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -75,7 +78,7 @@ function customLoader(ext: 'json' | 'yaml' | 'js' | 'ts') {
}

if (ext === 'ts') {
return TypeScriptLoader()(filepath, content);
return tsLoader(filepath, content);
}
}

Expand Down
15 changes: 5 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit cb1f936

Please sign in to comment.