Skip to content

Comments

Changed graphql->typescript codegen to treeshake types#6357

Draft
lkostrowski wants to merge 1 commit intomainfrom
smaller-generated
Draft

Changed graphql->typescript codegen to treeshake types#6357
lkostrowski wants to merge 1 commit intomainfrom
smaller-generated

Conversation

@lkostrowski
Copy link
Member

No description provided.

@lkostrowski lkostrowski requested a review from a team as a code owner February 23, 2026 21:21
@changeset-bot
Copy link

changeset-bot bot commented Feb 23, 2026

⚠️ No Changeset found

Latest commit: a67dadd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the GraphQL code generation configuration to enable treeshaking of TypeScript types by replacing the standard typescript plugin with a more optimized approach using typescript-operations with preResolveTypes and omitObjectTypes options, along with the new graphql-codegen-typescript-operation-types plugin.

Changes:

  • Added graphql-codegen-typescript-operation-types dependency
  • Replaced typescript plugin with optimized typescript-operations configuration
  • Updated import statements to use type modifier for better treeshaking

Reviewed changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated 2 comments.

File Description
package.json Added graphql-codegen-typescript-operation-types v2.0.2 as a dev dependency
codegen-staging.ts Updated plugin configuration to use treeshaking-optimized plugins and added type import modifier
codegen-main.ts Updated plugin configuration to use treeshaking-optimized plugins and added type import modifier
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment on lines +24 to +36
plugins: [
{
"typescript-operations": {
preResolveTypes: true,
omitObjectTypes: true,
},
},
{
"graphql-codegen-typescript-operation-types": {
enumsAsTypes: true,
},
},
],
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The typescript base plugin has been removed but typescript-operations requires it as a prerequisite. The typescript plugin generates the base GraphQL schema types that typescript-operations depends on. Without it, the code generation will fail.

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +40
plugins: [
{
"typescript-operations": {
preResolveTypes: true,
omitObjectTypes: true,
},
},
{
"graphql-codegen-typescript-operation-types": {
enumsAsTypes: true,
},
},
],
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The typescript base plugin has been removed but typescript-operations requires it as a prerequisite. The typescript plugin generates the base GraphQL schema types that typescript-operations depends on. Without it, the code generation will fail.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

Differences Found

⚠️ 1 packages or licenses were added.

Expand
License	Package
MIT	graphql-codegen-typescript-operation-types

Summary

Expand
License Name Package Count Packages
0BSD 1
Packages
  • tslib
CC0-1.0 1
Packages
  • type-fest
MIT/X11 1
Packages
  • nub
MPL-1.1 1
Packages
  • harmony-reflect
MPL-2.0 1
Packages
  • dompurify
Public Domain 1
Packages
  • jsonify
Python-2.0 1
Packages
  • argparse
WTFPL 1
Packages
  • utf8-byte-length
CC-BY-4.0 2
Packages
  • @saleor/macaw-ui
  • caniuse-lite
SEE LICENSE IN LICENSE 2
Packages
  • posthog-js
  • spawndamnit
BlueOak-1.0.0 7
Packages
  • @isaacs/cliui
  • glob
  • jackspeak
  • lru-cache
  • minimatch
  • package-json-from-dist
  • path-scurry
<<missing>> 11
Packages
  • @sentry/cli
  • @sentry/cli-darwin
  • @sentry/cli-linux-arm
  • @sentry/cli-linux-arm64
  • @sentry/cli-linux-i686
  • @sentry/cli-linux-x64
  • @sentry/cli-win32-arm64
  • @sentry/cli-win32-i686
  • @sentry/cli-win32-x64
  • busboy
  • streamsearch
BSD-2-Clause 23
Packages
  • browser-process-hrtime
  • css-select
  • css-what
  • domelementtype
  • domhandler
  • domutils
  • dotenv
  • dotenv-expand
  • entities
  • escodegen
  • eslint-scope
  • espree
  • esprima
  • esrecurse
  • estraverse
  • esutils
  • nth-check
  • regjsparser
  • stringify-object
  • terser
  • And 3 more...
ISC 48
Packages
  • @istanbuljs/load-nyc-config
  • anymatch
  • boolbase
  • cli-width
  • cliui
  • electron-to-chromium
  • fastq
  • flatted
  • foreground-child
  • fs.realpath
  • get-caller-file
  • get-own-enumerable-property-symbols
  • glob
  • glob-parent
  • graceful-fs
  • inflight
  • inherits
  • ini
  • isexe
  • knip
  • And 28 more...
BSD-3-Clause 52
Packages
  • @protobufjs/aspromise
  • @protobufjs/base64
  • @protobufjs/codegen
  • @protobufjs/eventemitter
  • @protobufjs/fetch
  • @protobufjs/float
  • @protobufjs/inquire
  • @protobufjs/path
  • @protobufjs/pool
  • @protobufjs/utf8
  • @saleor/app-sdk
  • @sentry/cli
  • @sentry/cli-darwin
  • @sentry/cli-linux-arm
  • @sentry/cli-linux-arm64
  • @sentry/cli-linux-i686
  • @sentry/cli-linux-x64
  • @sentry/cli-win32-i686
  • @sentry/cli-win32-x64
  • @sinonjs/commons
  • And 32 more...
Apache-2.0 64
Packages
  • @editorjs/editorjs
  • @eslint/config-array
  • @eslint/config-helpers
  • @eslint/core
  • @eslint/object-schema
  • @eslint/plugin-kit
  • @humanfs/core
  • @humanfs/node
  • @humanwhocodes/module-importer
  • @humanwhocodes/retry
  • @opentelemetry/api
  • @opentelemetry/api-logs
  • @opentelemetry/core
  • @opentelemetry/exporter-logs-otlp-http
  • @opentelemetry/otlp-exporter-base
  • @opentelemetry/otlp-transformer
  • @opentelemetry/resources
  • @opentelemetry/sdk-logs
  • @opentelemetry/sdk-metrics
  • @opentelemetry/sdk-trace-base
  • And 44 more...
MIT 1306
Packages
  • @adobe/css-tools
  • @apollo/client
  • @ardatan/relay-compiler
  • @ardatan/sync-fetch
  • @babel/code-frame
  • @babel/compat-data
  • @babel/core
  • @babel/generator
  • @babel/helper-annotate-as-pure
  • @babel/helper-compilation-targets
  • @babel/helper-create-class-features-plugin
  • @babel/helper-globals
  • @babel/helper-member-expression-to-functions
  • @babel/helper-module-imports
  • @babel/helper-module-transforms
  • @babel/helper-optimise-call-expression
  • @babel/helper-plugin-utils
  • @babel/helper-replace-supers
  • @babel/helper-skip-transparent-expression-wrappers
  • @babel/helper-string-parser
  • And 1286 more...

@witoszekdev
Copy link
Member

I think for Dashboard maybe we could use knip to remove unused types from generated? 🤔

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