Skip to content

chore(deps): upgrade graphql-request to v6 - #245

Open
eitoball wants to merge 1 commit into
mainfrom
upgrade/graphql-request-v6
Open

chore(deps): upgrade graphql-request to v6#245
eitoball wants to merge 1 commit into
mainfrom
upgrade/graphql-request-v6

Conversation

@eitoball

Copy link
Copy Markdown
Collaborator

What

Upgrades graphql-request from ^4.0.0 to ^6.1.0 and @graphql-codegen/typescript-graphql-request from ^4.0.0 to ^6.2.0, and fixes the generated ClientError import so it keeps resolving on the newer package.

Why

The latest graphql-request is v7, and getting there safely requires going through v6 first: @graphql-codegen/typescript-graphql-request's peerDependencies range on graphql-request jumps directly from ~5.1.0 to ^6.0.0 — there is no published version that supports both, so the two packages must be bumped together rather than one version at a time.

Separately, graphql-request v5.2.0 added a package.json exports field, which blocks deep subpath imports. This plugin's generated SDK code did:

import { ClientError } from 'graphql-request/dist/types'

That subpath stops resolving once a consumer installs graphql-request v5.2.0+, breaking every project generated with this plugin. ClientError has been exported from the package root since v4, so the fix is to import from the root instead.

This is step 1 of a planned two-step migration (v4 → v6 → v7); the v7 jump will follow in a separate PR once its own breaking changes (ESM-only export map at v7.0.0, restored CJS support at v7.4.0, spec-compliant default Accept header, HeadersInit-based header typing) are verified against this plugin's generated output.

Changes

  • src/visitor.ts: generated import changed from 'graphql-request/dist/types' to 'graphql-request'
  • tests/swr.spec.ts: updated the assertion covering the generated import to match
  • package.json: bumped graphql-request to ^6.1.0 and @graphql-codegen/typescript-graphql-request to ^6.2.0
  • yarn.lock: regenerated for the above

Test plan

  • yarn test (build + eslint + prettier + jest) passes with the new dependency versions
  • TDD: confirmed the updated assertion fails against the old generated import (RED) before the visitor.ts fix, then passes (GREEN) after

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The smoke-test sample remains pinned to v4 and retains documentation claiming the now-fixed incompatibility.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Upgrades the GraphQL request stack to v6 and fixes generated ClientError imports.

Changes:

  • Bumps related dependencies and lockfile entries.
  • Imports ClientError from the package root.
  • Updates the corresponding generation test.
File summaries
File Description
package.json Upgrades GraphQL request dependencies.
yarn.lock Resolves upgraded dependency graph.
src/visitor.ts Generates the supported root import.
tests/swr.spec.ts Updates the import assertion.
Review details
  • Files reviewed: 3/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread package.json
@eitoball
eitoball force-pushed the upgrade/graphql-request-v6 branch from 330a46d to 92fd16e Compare August 30, 2026 08:57
graphql-request v5.2.0 introduced a package.json `exports` field that
blocks deep subpath imports, so the generated `import { ClientError }
from 'graphql-request/dist/types'` stops resolving. Switch the
generated import to the package root, which has exported `ClientError`
consistently since v4.

@graphql-codegen/typescript-graphql-request is bumped alongside it
since its peerDependency on graphql-request jumps straight from
`~5.1.0` to `^6.0.0` with no version that supports both in between.
@eitoball
eitoball force-pushed the upgrade/graphql-request-v6 branch from 92fd16e to 60d4ebb Compare August 30, 2026 09:00
@eitoball
eitoball requested a balanced review from Copilot August 30, 2026 09:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The dependency upgrade, generated import fix, tests, and smoke-test sample are consistent and complete.

Review details
  • Files reviewed: 5/7 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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.

2 participants