Skip to content

CODEGEN-759: Update @graphql-codegen/graphql-request peerDep version to 7.0.0#1106

Merged
eddeee888 merged 8 commits intomainfrom
update-graphql-request-package
May 26, 2025
Merged

CODEGEN-759: Update @graphql-codegen/graphql-request peerDep version to 7.0.0#1106
eddeee888 merged 8 commits intomainfrom
update-graphql-request-package

Conversation

@eddeee888
Copy link
Copy Markdown
Collaborator

Description

Related #743

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 20, 2025

🦋 Changeset detected

Latest commit: 776569a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-codegen/typescript-graphql-request Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@eddeee888 eddeee888 changed the title CODEGEN-759: Update graphql request package CODEGEN-759: Update graphql-request version to 7.0.0 May 20, 2025
@eddeee888 eddeee888 changed the title CODEGEN-759: Update graphql-request version to 7.0.0 CODEGEN-759: Update @graphql-codegen/graphql-request peerDep version to 7.0.0 May 20, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-codegen/c-sharp 5.1.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/c-sharp-common 1.1.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/c-sharp-operations 3.1.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/flutter-freezed 4.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/flow 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/flow-operations 3.0.2-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/flow-resolvers 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/java-apollo-android 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/java-common 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/java 4.0.2-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/kotlin 3.0.2-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/java-resolvers 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/hasura-allow-list 3.1.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/jsdoc 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/urql-introspection 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-apollo-angular 4.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-apollo-client-helpers 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-enum-array 3.1.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-generic-sdk 4.0.2-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-graphql-apollo 2.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-graphql-files-modules 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-graphql-request 6.2.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-jit-sdk 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-mongodb 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-msw 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/named-operations-object 3.1.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-nest 1.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-nhost 0.0.3-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-oclif 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-react-apollo 4.3.3-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-react-offix 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-react-query 6.1.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-rtk-query 3.1.2-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-solid-query 1.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-stencil-apollo 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-type-graphql 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-urql 4.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-urql-graphcache 3.1.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/urql-svelte-operations-store 2.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-vue-apollo 4.1.2-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-vue-apollo-smart-ops 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-vue-urql 3.2.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/import-types-preset 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎
@graphql-codegen/near-operation-file-preset 3.0.1-alpha-20250526095640-776569a64156c1ae2a72755f5c40fe654aaa6e39 npm ↗︎ unpkg ↗︎

Comment thread jest.project.js
...(CI || !projectMode ? {} : { displayName: pkg.name.replace('@graphql-codegen/', '') }),
transform: { '^.+\\.tsx?$': 'babel-jest' },
transform: { '^.+\\.[tj]sx?$': 'babel-jest' },
transformIgnorePatterns: ['/node_modules/(?!(graphql-request)/)'],
Copy link
Copy Markdown
Collaborator Author

@eddeee888 eddeee888 May 22, 2025

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-request is ESM, we need to run it through babel-jest:

  • transformIgnorePatterns is used to tell Jest to transform graphql-request in node_modules (node_modules are ignored by default)
  • transform tells Jest to run babel-jest on .js files in graphql-request to turn ESM to CJS

"@graphql-tools/schema": "10.0.23",
"graphql-request": "6.0.0"
"graphql-request": "7.1.2",
"node-fetch": "2.7.0"
Copy link
Copy Markdown
Collaborator Author

@eddeee888 eddeee888 May 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

graphql-request@6 uses cross-fetch, whilst graphql-request@7 uses native fetch (undici)
undici is built in a way that nock@14 and below does not support (support is coming in nock v15)

So, for tests to work, we need to pass a fetch function that nock supports, because mockGraphQLServer from @graphql-codegen/testing is using [email protected]

@eddeee888 eddeee888 force-pushed the update-graphql-request-package branch from 923c881 to f6bde1e Compare May 22, 2025 12:53
@eddeee888 eddeee888 force-pushed the update-graphql-request-package branch 2 times, most recently from ede7321 to a4e44f4 Compare May 24, 2025 14:25
@eddeee888 eddeee888 force-pushed the update-graphql-request-package branch from a4e44f4 to 37f544b Compare May 24, 2025 14:32
Comment on lines +14 to +22
// @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;
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dotansimha , @jasonkuhrt,

For [email protected]:
I observe [email protected] doesn't work with graphql@15 because of the way it uses OperationTypeNode:

Screenshot 2025-05-25 at 12 33 20 am

I'm thinking we could update graphql-request@7 package to drop graphql@15 as peerDep, but looks like graffle is under development, so don't know what the effort to release v7.1.3 is ? Or whther it's possible? 🤔


For this plugin:
This hack is a bit gross but I couldn't find a quick way to stop testing graphql@15 just for this plugin. One way I could think of is to split the test command to have control over which packages to test, and split graphql-request CLI into another CI step.

Keen to hear if you have preferences or ideas!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay, new graphql-request version works. Hack removed. I can live with my conscience 😆

Thank you!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy it worked out!

@eddeee888 eddeee888 merged commit 9c1fbdd into main May 26, 2025
13 checks passed
@eddeee888 eddeee888 deleted the update-graphql-request-package branch May 26, 2025 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants