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

feat(presets/client): support enumsAsConst option #9981

Merged
merged 6 commits into from
Nov 21, 2024

Conversation

azu
Copy link
Contributor

@azu azu commented May 29, 2024

Description

Add enumsAsConst to client presets.

Related

Edit:

This PR is duplicated of #9574, but this includes a test.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Screenshots/Sandbox (if appropriate/relevant):

Add Unit Test

How Has This Been Tested?

  • Add a test case for enumsAsConst
  • Run npm test

Test Environment:

  • OS: macOS
  • @graphql-codegen/...: latest
  • NodeJS:v18.19.0

Checklist:

  • I have followed the CONTRIBUTING doc and the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

client preset already support enumsAsType.
I think that it should support enumsAsConst too.

Copy link

changeset-bot bot commented May 29, 2024

🦋 Changeset detected

Latest commit: 21e7d1f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-codegen/client-preset Patch

Not sure what this means? Click here to learn what changesets are.

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

@azu
Copy link
Contributor Author

azu commented May 29, 2024

Ah, I notice that this PR is duplicated of #9574, but this PR includes a test.

Copy link
Collaborator

@n1ru4l n1ru4l left a comment

Choose a reason for hiding this comment

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

Can you please also update website/src/pages/plugins/presets/preset-client.mdx

@azu
Copy link
Contributor Author

azu commented Jun 7, 2024

@n1ru4l Thanks.
I've added enumsAsConst to website/src/pages/plugins/presets/preset-client.mdx
c9a3511

@nebbles
Copy link
Contributor

nebbles commented Aug 10, 2024

@azu maybe worth re-requesting review from @n1ru4l now that you've made the requested changes? Would be great to see this land in client-preset.

@azu azu requested a review from n1ru4l August 10, 2024 12:36
@sampsonjoliver
Copy link

+1 to this change, this would resolve several headaches for my org.

@SimonTernoir
Copy link

SimonTernoir commented Nov 16, 2024

Great work @azu, this would be an amazing change for us as well if it could get merged!
I’d be more than happy to help if needed to make this happen @n1ru4l

Note: While waiting for the official change, you can throw this dirty little workaround into a package.json script to get the job done 😱 grep -q 'enumsAsConst' node_modules/@graphql-codegen/client-preset/cjs/index.js || sed -i '' '/enumsAsTypes: options.config.enumsAsTypes,/s/$/ enumsAsConst: options.config.enumsAsConst,/' node_modules/@graphql-codegen/client-preset/cjs/index.js

Copy link
Collaborator

@eddeee888 eddeee888 left a comment

Choose a reason for hiding this comment

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

Thank you!

@eddeee888 eddeee888 merged commit 05aa6b4 into dotansimha:master Nov 21, 2024
@azu azu deleted the presets-with-enumsAsConst branch November 21, 2024 12:21
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.

6 participants