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

client preset is ignoring a lot of configs #9104

Closed
christiansany opened this issue Mar 4, 2023 · 4 comments
Closed

client preset is ignoring a lot of configs #9104

christiansany opened this issue Mar 4, 2023 · 4 comments

Comments

@christiansany
Copy link

christiansany commented Mar 4, 2023

Which packages are impacted by your issue?

No response

Describe the bug

The Configs that we should be able to use with the new client preset don't do anything.
The client preset should use the typescript plugin underneath, but the config that can be used with the typescript plugin doesn't do anything.

Can we fix this?

In Addition, the client preset generates types for the Schema and the Queries. But in the index.ts file that is generated these types are not exported.

Steps to Reproduce the Bug or Issue

  1. Try it in any project that is using the client preset

Expected behavior

I want the config for the typescript plugin to also work with the client preset

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • NodeJS: [e.g. 18.5.0]
  • graphql version: [e.g. 16.3.0]
  • @graphql-codegen/* version(s): [e.g. 2.6.2]

Codegen Config File

import { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
  schema: "./__generated__/schema.graphql",
  documents: [
    "./**/*.js",
    "./**/*.vue",
    "./**/*.ts",
    "!./__generated__/schema.graphql",
    "!./**/node_modules/**/*",
    "!./**/*.test.*",
    "!./**/*.d.ts",
  ],
  generates: {
    "./__generated__/gql/": {
      preset: "client",
      presetConfig: {
        gqlTagName: "gql",
        fragmentMasking: { unmaskFunctionName: "getFragmentData" },
        enumsAsConst: true, // Doesn't do anything (probably should not work, but I tried it anyway)
        immutableTypes: true, // Doesn't do anything (probably should not work, but I tried it anyway)
      },
      config: {
        enumsAsConst: true, // Doesn't do anything
        immutableTypes: true, // Doesn't do anything
      },
    },
    "./__generated__/schema.ts": {
      plugins: ["typescript"],
      config: {
        enumsAsConst: true, // Works fine here
        immutableTypes: true, // Works fine here
      },
    },
  },
  ignoreNoDocuments: true,
};

export default config;

Additional context

No response

@mogelbrod
Copy link

mogelbrod commented Mar 15, 2023

Here's another bug report related to this: #8576 (comment)

@2snEM6
Copy link

2snEM6 commented Apr 24, 2023

Any news on this? This is key so for example https://the-guild.dev/graphql/codegen/plugins/typescript/relay-operation-optimizer can be used with client-preset

@rszalski
Copy link

rszalski commented May 3, 2023

Same issue here. To workaround this, I am considering using the lower-level plugins that the client preset wraps around, directly. Also linking the discussion I found: #8993

@n1ru4l
Copy link
Collaborator

n1ru4l commented Jun 12, 2023

See #8993 (comment) and #9496 (comment)

@n1ru4l n1ru4l closed this as completed Jun 12, 2023
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

No branches or pull requests

5 participants