-
Notifications
You must be signed in to change notification settings - Fork 196
CODEGEN-759: Update @graphql-codegen/graphql-request peerDep version to 7.0.0 #1106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
cff2a7e
414dce0
013cad5
0a815ec
5f0535f
aa7f2da
37f544b
776569a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@graphql-codegen/typescript-graphql-request': patch | ||
| --- | ||
|
|
||
| Make graphql-request@v7 peerDep |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ | |
| }, | ||
| "peerDependencies": { | ||
| "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0", | ||
| "graphql-request": "^6.0.0", | ||
| "graphql-request": "^6.0.0 || ^7.0.0", | ||
| "graphql-tag": "^2.0.0" | ||
| }, | ||
| "dependencies": { | ||
|
|
@@ -50,7 +50,8 @@ | |
| "devDependencies": { | ||
| "@graphql-codegen/testing": "1.18.3", | ||
| "@graphql-tools/schema": "10.0.23", | ||
| "graphql-request": "6.0.0" | ||
| "graphql-request": "7.1.2", | ||
| "node-fetch": "2.7.0" | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So, for tests to work, we need to pass a |
||
| }, | ||
| "publishConfig": { | ||
| "directory": "dist", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import { join } from 'path'; | ||
| import { remove, writeFile } from 'fs-extra'; | ||
| import { parse } from 'graphql'; | ||
| // @ts-ignore | ||
| import { OperationTypeNode, parse } from 'graphql'; | ||
| import { codegen } from '@graphql-codegen/core'; | ||
| import { mockGraphQLServer } from '@graphql-codegen/testing'; | ||
| import * as TypeScriptPlugin from '@graphql-codegen/typescript'; | ||
|
|
@@ -10,6 +11,16 @@ import * as GraphQLRequestPlugin from '../src/index.js'; | |
|
|
||
| describe('GraphQL Request Integration', () => { | ||
| it('should send requests correctly', async () => { | ||
| // @ts-ignore | ||
| if (!OperationTypeNode) { | ||
| // `OperationTypeNode` is a type in `graphql@15`, but it is a native TS enum in `graphql@16`. | ||
| // `graphql-request@7` uses `OperationTypeNode` enum to analyse document. | ||
| // So, `graphql-request@7` does not work with `graphql@15`. | ||
| // | ||
| // This block is a hacky way to skip running this test for `graphql@15`. | ||
| return; | ||
| } | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @dotansimha , @jasonkuhrt, For
I'm thinking we could update For this plugin: Keen to hear if you have preferences or ideas! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @eddeee888 I could make a release to do what you are suggesting by easily. We have a branch called legacy for just this kind of reason. Do you want to make a PR to it and we can discuss further?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah good to know about the legacy branch! I think I can make a PR to that branch tonight
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yay, new Thank you! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Happy it worked out! |
||
|
|
||
| const sdkFileName = 'graphql-request-sdk.ts'; | ||
| const sdkFilePath = join(__dirname, './test-files', sdkFileName); | ||
| const typeDefs = parse(/* GraphQL */ ` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| import { GraphQLClient } from 'graphql-request'; | ||
| import fetch from 'node-fetch'; // FIXME: using `node-fetch` temporarily because `graphql-request@7` uses native fetch, which `[email protected]` from `@graphql-codegen/testing` does not support | ||
| import { getSdk } from './graphql-request-sdk.js'; | ||
|
|
||
| export function runExampleQuery(x: number, y: number) { | ||
| const client = new GraphQLClient('http://localhost:4000/graphql'); | ||
| const client = new GraphQLClient('http://localhost:4000/graphql', { fetch }); | ||
| const sdk = getSdk(client); | ||
| return sdk.Add({ x, y }); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4593,7 +4593,14 @@ graphql-language-service-utils@^2.7.1: | |
| graphql-language-service-types "^1.8.7" | ||
| nullthrows "^1.0.0" | ||
|
|
||
| [email protected], "graphql-request@^4.0.0 || ^5.0.0 || ^6.0.0", graphql-request@^6.0.0: | ||
| [email protected]: | ||
| version "7.1.2" | ||
| resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-7.1.2.tgz#52d7fd6d8d08c9f0b00c84a091376ce9fbdfa945" | ||
| integrity sha512-+XE3iuC55C2di5ZUrB4pjgwe+nIQBuXVIK9J98wrVwojzDW3GMdSBZfxUk8l4j9TieIpjpggclxhNEU9ebGF8w== | ||
| dependencies: | ||
| "@graphql-typed-document-node/core" "^3.2.0" | ||
|
|
||
| "graphql-request@^4.0.0 || ^5.0.0 || ^6.0.0", graphql-request@^6.0.0: | ||
| version "6.0.0" | ||
| resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-6.0.0.tgz#9c8b6a0c341f289e049936d03cc9205300faae1c" | ||
| integrity sha512-2BmHTuglonjZvmNVw6ZzCfFlW/qkIPds0f+Qdi/Lvjsl3whJg2uvHmSvHnLWhUTEw6zcxPYAHiZoPvSVKOZ7Jw== | ||
|
|
@@ -6052,7 +6059,7 @@ [email protected]: | |
| lodash "^4.17.21" | ||
| propagate "^2.0.0" | ||
|
|
||
| node-fetch@^2.5.0, node-fetch@^2.6.1, node-fetch@^2.7.0: | ||
| node-fetch@2.7.0, node-fetch@^2.5.0, node-fetch@^2.6.1, node-fetch@^2.7.0: | ||
| version "2.7.0" | ||
| resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" | ||
| integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required because we use
[email protected]in dev to run jest, which uses ESM. Jest can only run CJS by default.Since
graphql-requestis ESM, we need to run it throughbabel-jest:transformIgnorePatternsis used to tell Jest to transformgraphql-requestinnode_modules(node_modulesare ignored by default)transformtells Jest to runbabel-jeston.jsfiles ingraphql-requestto turn ESM to CJS