Skip to content

DEVPROD-31333: Switch to gql templates from .graphql#1532

Merged
sophstad merged 13 commits intoevergreen-ci:mainfrom
sophstad:graphql-gql-template-migration
Apr 10, 2026
Merged

DEVPROD-31333: Switch to gql templates from .graphql#1532
sophstad merged 13 commits intoevergreen-ci:mainfrom
sophstad:graphql-gql-template-migration

Conversation

@sophstad
Copy link
Copy Markdown
Contributor

@sophstad sophstad commented Apr 7, 2026

DEVPROD-31333

Description

Convert our .graphql files into TypeScript files that use Apollo's gql tag. Using .graphql files requires a Babel transform, which:

  1. Slows down HMR during development
  2. May prevent leveraging the benefits of Rolldown's improved tree-shaking abilities in Vite 8

Ahead of upgrading, let's try removing this major Babel dependency. The last remaining one is for Emotion, which will be done in a followup.

Changes

  • Replace each .graphql file
  • Add transform ESLint step so we can continue leveraging the same linter
  • Use single-line named import/exports in barrel files
  • Remove vite-plugin-import-graphql

sophstad added 8 commits April 7, 2026 13:38
Replace babel-plugin-import-graphql by converting all .graphql query,
mutation, and fragment files to TypeScript files using Apollo Client's
gql template literal syntax. This removes the dependency on
babel-plugin-import-graphql and is a prerequisite for fully removing
Babel from the build pipeline.

Changes:
- Convert ~200 .graphql files to .ts with gql tagged templates
- Update barrel index.ts files to import from .ts instead of .graphql
- Update graphql-codegen configs to scan .ts files for gql tags
- Remove babel-plugin-import-graphql from vite/vitest configs
- Remove babel-plugin-import-graphql from package.json devDependencies
- Remove *.graphql module declarations from vite-env.d.ts files

Made-with: Cursor
Convert all query/mutation files from default exports to named exports
and simplify barrel index files to single-line re-exports. This aligns
with the fragment files which already used named exports.

Made-with: Cursor
All gql template literals live under src/gql/, so restrict the codegen
documents glob to avoid scanning the entire src tree.

Made-with: Cursor
Remove 10 query/mutation/fragment files that were converted from
.graphql files already deleted on main (logkeeper removal, pod queries,
beta features duplicated in lib, etc.).

Update graphql-eslint config to use the processor for extracting
GraphQL from gql tagged template literals in .ts files instead of
linting .graphql files directly.

Made-with: Cursor
Each gql tag only includes the fragment definitions it actually
spreads, eliminating runtime unused-fragment warnings from Apollo.

Made-with: Cursor
…e-migration

Made-with: Cursor

# Conflicts:
#	apps/spruce/src/gql/fragments/projectSettings/variables.graphql
#	apps/spruce/src/gql/mutations/index.ts
#	apps/spruce/src/gql/mutations/save-admin-settings.graphql
#	apps/spruce/src/gql/queries/admin-settings.graphql
#	apps/spruce/src/gql/queries/index.ts
#	apps/spruce/src/gql/queries/user-distro-settings-permissions.graphql
#	apps/spruce/src/gql/queries/user-project-settings-permissions.graphql
#	apps/spruce/src/gql/queries/user-repo-settings-permissions.graphql
#	pnpm-lock.yaml
…e-migration

Made-with: Cursor

# Conflicts:
#	packages/eslint-config/eslint.config.js
@sophstad sophstad added spruce parsley lib Updates to the @evg-ui/lib package labels Apr 9, 2026
@sophstad sophstad marked this pull request as ready for review April 9, 2026 20:23
@sophstad sophstad requested a review from a team as a code owner April 9, 2026 20:23
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we can remove this i deleted this one in an earlier pr

Copy link
Copy Markdown
Contributor

@athammer athammer left a comment

Choose a reason for hiding this comment

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

lotta files but other than the thing i commented above not really seeing anything popping out

…e-migration

Made-with: Cursor

# Conflicts:
#	apps/spruce/src/gql/queries/task-files.graphql
@sophstad sophstad merged commit 9adf7b2 into evergreen-ci:main Apr 10, 2026
19 checks passed
@sophstad sophstad deleted the graphql-gql-template-migration branch April 10, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib Updates to the @evg-ui/lib package parsley spruce

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants