Skip to content

feat: importTypesPath for gql-tag-operations-preset#8380

Open
ferm10n wants to merge 3 commits intodotansimha:masterfrom
RV-Argonaut:gql-tag-operations-import-types
Open

feat: importTypesPath for gql-tag-operations-preset#8380
ferm10n wants to merge 3 commits intodotansimha:masterfrom
RV-Argonaut:gql-tag-operations-import-types

Conversation

@ferm10n
Copy link
Copy Markdown

@ferm10n ferm10n commented Sep 24, 2022

🚨 IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

This adds support for specifying an import typesPath for the gql-tag-operations-preset, just like import-types.

Related #8379

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):

Adding links to sandbox or providing screenshots can help us understand more about this PR and take action on it as appropriate

How Has This Been Tested?

I've added a test case to gql-tag-operations.spec.ts, when presetConfig.importTypesPath is set, the typescript plugin is not included, an import to the types path is prepended, and and base type references use the imported types (Exact is coverted to Types.Exact. It builds successfully, tests pass and I've used it successfully in the monorepo I described in #8379

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

This implementation seemed the simplest, but I'm wondering if it would make sense to try and refactor gql-tag-operations plugin to be more usable as a standalone plugin instead of it being blocked behind the preset, and remove the preset altogether. I don't feel confident enough with my understanding of the codebase yet to take that on that effort, but I'd be open to the idea if I got some encouragement on this direction from a maintainer :)

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Sep 24, 2022

🦋 Changeset detected

Latest commit: 5f71fe1

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/gql-tag-operations-preset Minor

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

@ferm10n
Copy link
Copy Markdown
Author

ferm10n commented Sep 24, 2022

I marked this as "needing documentation update" because it adds options. I added jsdoc annotations but I'm not sure if that's all that's required.

@ferm10n ferm10n force-pushed the gql-tag-operations-import-types branch from af2fb87 to be3f0e6 Compare September 24, 2022 22:10
@ferm10n ferm10n marked this pull request as ready for review September 24, 2022 22:12
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