graphql-code-generator icon indicating copy to clipboard operation
graphql-code-generator copied to clipboard

GraphQL Code Generator v3: RFC umbrella PR

Open charlypoly opened this issue 3 years ago • 7 comments

  • [x] Remove augmentedModuleName and expose a graphql() instead of gql()
    • [x] update preset generation code
    • [x] ensure graphql-tools loaders can identify those graphql() calls
    • [x] rename babel-plugin → babel-optimizer-plugin
  • [x] stop forwarding plugins (config) to typescript and typescript-operations plugin
  • [x] Target codegen config design
const config = {
  schema: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
  documents: ['src/**/*.tsx'],
  generates: {
    './src/gql/': {
      preset: 'client',
      plugins: [],
    },
  },
};

export default config;

  • [x] documents override (exclusion of generate path)
  • [ ] ~handling of .graphql files? (with typed-document-node under the hood)~
  • [x] remove “(using EXPERIMENTAL preset "gql-tag-operations-preset")” warning
  • [x] ship client-preset by default via the CLI package
    • [x] update init accordingly
  • [x] TypeScript config first

Post-release TODOs

  • [ ] deprecate gql-tag-operations-preset :

npm deprecate @graphql-codegen/gql-tag-operations-preset "gql-tag-operations-preset is deprecated in favor of client-preset"

charlypoly avatar Aug 17 '22 15:08 charlypoly

🦋 Changeset detected

Latest commit: 5ea6d6807bd4b4f84e00504039cefc72dc6a8100

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

This PR includes changesets to release 5 packages
Name Type
@graphql-codegen/cli Major
@graphql-cli/codegen Major
@graphql-codegen/gql-tag-operations Minor
@graphql-codegen/client-preset Patch
@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

changeset-bot[bot] avatar Aug 17 '22 15:08 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
graphql-code-generator ✅ Ready (Inspect) Visit Preview Aug 29, 2022 at 10:47AM (UTC)

vercel[bot] avatar Aug 17 '22 15:08 vercel[bot]

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: b4b6ce5
Status:🚫  Build failed.

View logs

🚀 Snapshot Release (v3rfc)

The latest changes of this PR are available as v3rfc on npm (based on the declared changesets):

Package Version Info
@graphql-cli/codegen 3.0.0-v3rfc-20220829104332-c07568002 npm ↗︎ unpkg ↗︎
@graphql-codegen/cli 3.0.0-v3rfc-20220829104332-c07568002 npm ↗︎ unpkg ↗︎
@graphql-codegen/gql-tag-operations 1.5.0-v3rfc-20220829104332-c07568002 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-graphql-request 4.5.4-v3rfc-20220829104332-c07568002 npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-rtk-query 2.3.4-v3rfc-20220829104332-c07568002 npm ↗︎ unpkg ↗︎
@graphql-codegen/client-preset 1.0.1-v3rfc-20220829104332-c07568002 npm ↗︎ unpkg ↗︎
@graphql-codegen/gql-tag-operations-preset 1.6.0-v3rfc-20220829104332-c07568002 npm ↗︎ unpkg ↗︎

github-actions[bot] avatar Aug 18 '22 14:08 github-actions[bot]

/theguild newsletter blog

charlypoly avatar Aug 22 '22 07:08 charlypoly

ESM support blocked by same issue as https://github.com/dotansimha/graphql-code-generator/issues/8212

charlypoly avatar Aug 25 '22 15:08 charlypoly

Just wanted to mention it here so it does not go "forgotten", we should document how to consume the ypings in your custom graphql fetcher implementation e.g. for library authors, https://github.com/dotansimha/graphql-code-generator/blob/7f2f050256c200d948bd7a9df3e6df72f01eb8bd/examples/typescript-esm/src/executeOperation.ts#L6-L10

n1ru4l avatar Aug 26 '22 11:08 n1ru4l