Repository navigation
SRE-1215: Upgrade @graphql-codegen/cli to 7 and its plugins to their next majors - #10088
claude[bot] wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10088 +/- ##
=======================================
Coverage 68.01% 68.02%
=======================================
Files 2003 2003
Lines 205921 205921
Branches 8786 8786
=======================================
+ Hits 140059 140073 +14
+ Misses 64197 64185 -12
+ Partials 1665 1663 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Move `@graphql-codegen/cli` to 7.4.6 and the official plugins to their next majors (`typescript` and `typescript-operations` 6, `typescript-resolvers` 6, `introspection` 6, `fragment-matcher` 7). This lets `@graphql-tools/utils` resolve to 12.x across the lockfile. `typescript-operations` 6 now emits the Input and Enum types its operations use, so running it in the same file as `typescript` declares them twice. Follow upstream's multi-file setup: `typescript` (and `typescript-resolvers` in hash-api) writes `schema-types.gen.ts`, and `typescript-operations` writes `api-types.gen.ts`, imports schema types through `importSchemaTypesFrom` and re-exports them, so existing imports from `api-types.gen` keep working. Result types no longer carry an optional `__typename` unless the selection requests it, so `useHashInstance` picks the integration flags explicitly. Drop the unused `@graphql-codegen/typescript-graphql-request` from hash-backend-integration; its latest release still depends on the 6.x helpers.
29efe31 to
1847906
Compare
@graphql-codegen/cli to 7 and its plugins to their next majors@graphql-codegen/cli to 7 and its plugins to their next majors
PR SummaryMedium Risk Overview Codegen is restructured to avoid duplicate schema types under Runtime/type fallout: Reviewed by Cursor Bugbot for commit 758fccd. Bugbot is set up for automated code reviews on this repo. Configure here. |
Requested via Slack thread
🌟 Purpose
Prototype of the GraphQL Code Generator major upgrade, so we can see what it costs. The CLI 6 / plugin 5 line depends on
@graphql-tools/utils^11; the new majors depend on^12, so this moves@graphql-tools/utilsfrom 11.0.0 to 12.0.3 everywhere in the lockfile.🔍 Changes
@graphql-codegen/cli^6.2.1→^7.4.6,typescript5.0.9 → 6.1.2,typescript-operations5.0.9 → 6.1.10,typescript-resolvers5.1.7 → 6.1.1,introspection5.0.1 → 6.1.0,fragment-matcher6.0.0 → 7.1.0. Transitively, the@graphql-tools/*loaders,delegate,wrap,executor(1.x → 2.0.3) andgraphql-config5.1.8. Each package resolves to a single version.@graphql-codegen/add7.1.1 is added as a dev dependency where it is used.typescript-operations6 now generates the Input and Enum types its operations use, so running it in the same file astypescriptdeclared those types twice (10 to 18 duplicates per file). This follows upstream's multi-file setup:typescript(plustypescript-resolversin hash-api) writesschema-types.gen.ts, andtypescript-operationswritesapi-types.gen.tswithimportSchemaTypesFrom. Anaddline re-exports the schema types fromapi-types.gen.ts, so no import site changes. Upstream's single-file setup drops thetypescriptplugin, but hash-api imports about 100 resolver and args types and the frontend about 20 object types (such asFlowRun) from it, so we still need it.base-codegen-config.tsis now typed for both plugins, becauseskipTypenamemoved from the shared visitor config to thetypescriptplugin's config.__typenameunless the query selects it. That broke one call site,useHashInstance, which destructured__typenameaway; it now picks the two flags explicitly. Apollo still adds__typenameat runtime. Other changes that applied without type errors: nullable result fields are nowT | nullrather than optional (274 → 27 optional fields in the frontend's operation types), unmapped custom scalars default tounknowninstead ofany, and inputIDisstring | number.@graphql-codegen/typescript-graphql-requestfrom hash-backend-integration. Its latest stable release (7.1.0) still depends on the 6.x helpers that pin@graphql-tools/utils^11, and only an 8.0.0 alpha moves off them.*.gen.*files are gitignored, so they are not in the diff. After formatting before and after the same way, the regenerated output changes by roughly +880 / −870 lines across six workspaces (hash-frontend +352/−467, hash-api +264/−154, plugin-browser +96/−99, hash-playwright +92/−99, hash-isomorphic-utils +69/−42, hash-backend-integration +5/−10). The source diff is 93 added and 32 removed lines, plus the lockfile.Checked locally:
codegenin all six codegen workspaces.lint:tscthrough turbo for hash-isomorphic-utils, hash-backend-utils, hash-api, hash-frontend, plugin-browser, hash-playwright and hash-backend-integration. All clean after theuseHashInstancefix.test:unitfor hash-isomorphic-utils (360 tests), hash-api (311) and hash-frontend (1450). All pass.yarn install --immutable,yarn dedupe --strategy highest --checkandyarn constraints, all with Yarn 4.18.1.__typenameand?on result types could hide a mismatch with what Apollo's cache returns at runtime. That would show up as code narrowing on__typenamewith no type error.typescript-operationssetup that upstream recommends would mean replacing their uses of schema object types, and it is out of scope here.