Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename graphql export to g #9460

Merged
merged 7 commits into from
Feb 5, 2025
Merged

Rename graphql export to g #9460

merged 7 commits into from
Feb 5, 2025

Conversation

emmatown
Copy link
Member

@emmatown emmatown commented Feb 3, 2025

This renames the graphql export to g for two reasons:

  • More concise reading/writing schemas
  • To avoid conflicts with exports named graphql from libraries such as Relay, GraphQL Code Generator and gql.tada that use the variable name graphql to declare GraphQL operations

The graphql export still exists but is now deprecated and may be removed in a future release.

To quickly update usages of the graphql export in your project to use g:

  1. Navigate to node_modules/@keystone-6/core/dist/declarations/src/types/schema/legacy-alias.d.ts in your editor ("Go to Definition" will not take you to the correct file)
  2. Use "Rename Symbol" to rename graphql to g, this will update usages of graphql to g
  3. Change this deprecated alias back from g to graphql (avoid using "Rename Symbol" again because you want to preserve the updates you made in step 2)

Copy link

socket-security bot commented Feb 3, 2025

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@graphql-ts/[email protected] 🔁 npm/@graphql-ts/[email protected] None 0 103 kB thinkmill-release-bot
npm/@graphql-ts/[email protected] 🔁 npm/@graphql-ts/[email protected] None 0 203 kB thinkmill-release-bot

View full report↗︎

"@keystone-6/auth": major
---

Use `g` export instead of `graphql` from `@keystone-6/core`. The only breakage is that you must be on the version of `@keystone-6/core` that includes the `g` export or newer
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that this changeset has major changes but the @keystone-6/core changeset is only a minor since it's not breaking to add the new name and keep the old one around but using the new name is breaking since people must update @keystone-6/core otherwise these packages will not work. While this would be easily avoidable by using the old version, I don't think that complexity is worth it since people will already be forced to use all the new versions together because of the changes for @keystar/ui.

@emmatown emmatown force-pushed the graphql-ts-rename-to-g branch from 70362c0 to f9dcf5c Compare February 3, 2025 05:28
// preserve the updates you made to the usages of `graphql`
// |||||||
// vvvvvvv
export import graphql = _graphql
Copy link
Member Author

Choose a reason for hiding this comment

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

If you're curious why I'm using this weird syntax, see the latter part of the PR description of Thinkmill/graphql-ts#19

@emmatown emmatown force-pushed the graphql-ts-rename-to-g branch from f9dcf5c to 5f4caa2 Compare February 3, 2025 05:32
@emmatown emmatown marked this pull request as ready for review February 3, 2025 05:43
@dcousens dcousens force-pushed the graphql-ts-rename-to-g branch from 5f4caa2 to c08e05f Compare February 5, 2025 00:49
@dcousens dcousens force-pushed the graphql-ts-rename-to-g branch 2 times, most recently from 3572f25 to 4422deb Compare February 5, 2025 01:22
@emmatown emmatown force-pushed the graphql-ts-rename-to-g branch from 4422deb to ed6c96b Compare February 5, 2025 02:23
@emmatown emmatown merged commit c6ce0a7 into main Feb 5, 2025
45 of 46 checks passed
@emmatown emmatown deleted the graphql-ts-rename-to-g branch February 5, 2025 02:40
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.

1 participant