PackageTrack

npm · #3975

@graphql-codegen/core

6.2.0dotansimha/graphql-code-generator

Release timeline

5075 releases since 2019
20192020202120222023202420252026

Releases

  1. 3.1.1-alpha-20230522160226-e127fd54f22 May 2023pre-release

    Nothing published for this version

  2. 3.1.1-alpha-20230522111712-56f289acf22 May 2023pre-release

    Nothing published for this version

  3. 3.1.1-alpha-20230522110125-51789cf6722 May 2023pre-release

    Nothing published for this version

  4. 3.1.1-alpha-20230522105754-148a904b022 May 2023pre-release

    Nothing published for this version

  5. 3.1.021 Feb 2023
    Release notes

    Minor Changes

    • #8723 a3309e63e Thanks @kazekyo! - Introduce a new feature called DocumentTransform.

      DocumentTransform is a functionality that allows you to modify documents before they are processed by plugins. You can use functions passed to the documentTransforms option to make changes to GraphQL documents.

      To use this feature, you can write documentTransforms as follows:

      import type { CodegenConfig } from '@graphql-codegen/cli'
      
      const config: CodegenConfig = {
        schema: 'https://localhost:4000/graphql',
        documents: ['src/**/*.tsx'],
        generates: {
          './src/gql/': {
            preset: 'client',
            documentTransforms: [
              {
                transform: ({ documents }) => {
                  // Make some changes to the documents
                  return documents
                }
              }
            ]
          }
        }
      }
      export default config
      

      For instance, to remove a @localOnlyDirective directive from documents, you can write the following code:

      import type { CodegenConfig } from '@graphql-codegen/cli'
      import { visit } from 'graphql'
      
      const config: CodegenConfig = {
        schema: 'https://localhost:4000/graphql',
        documents: ['src/**/*.tsx'],
        generates: {
          './src/gql/': {
            preset: 'client',
            documentTransforms: [
              {
                transform: ({ documents }) => {
                  return documents.map(documentFile => {
                    documentFile.document = visit(documentFile.document, {
                      Directive: {
                        leave(node) {
                          if (node.name.value === 'localOnlyDirective') return null
                        }
                      }
                    })
                    return documentFile
                  })
                }
              }
            ]
          }
        }
      }
      export default config
      

      DocumentTransform can also be specified by file name. You can create a custom file for a specific transformation and pass it to documentTransforms.

      Let's create the document transform as a file:

      module.exports = {
        transform: ({ documents }) => {
          // Make some changes to the documents
          return documents
        }
      }
      

      Then, you can specify the file name as follows:

      import type { CodegenConfig } from '@graphql-codegen/cli'
      
      const config: CodegenConfig = {
        schema: 'https://localhost:4000/graphql',
        documents: ['src/**/*.tsx'],
        generates: {
          './src/gql/': {
            preset: 'client',
            documentTransforms: ['./my-document-transform.js']
          }
        }
      }
      export default config
      

    Patch Changes

    Open source →
  6. 3.1.0-alpha-20230221114242-f86f936ba21 Feb 2023pre-release

    Nothing published for this version

  7. 3.1.0-alpha-20230221113721-f86f936ba21 Feb 2023pre-release

    Nothing published for this version

  8. 3.0.2-alpha-20230217094942-ea4838cdc17 Feb 2023pre-release

    Nothing published for this version

  9. 3.0.2-alpha-20230217094649-681f221a917 Feb 2023pre-release

    Nothing published for this version

  10. 3.0.2-alpha-20230217092448-8af0f220517 Feb 2023pre-release

    Nothing published for this version

  11. 3.0.1-alpha-20230221165357-bfc52c52421 Feb 2023pre-release

    Nothing published for this version

  12. 3.0.1-alpha-20230221061459-72945a96221 Feb 2023pre-release

    Nothing published for this version

  13. 3.0.1-alpha-20230221061345-f4f03996621 Feb 2023pre-release

    Nothing published for this version

  14. 3.0.1-alpha-20230220220309-b5de7da6620 Feb 2023pre-release

    Nothing published for this version

  15. 3.0.1-alpha-20230220220141-e01f01d5120 Feb 2023pre-release

    Nothing published for this version

  16. 3.0.1-alpha-20230220215608-bfc52c52420 Feb 2023pre-release

    Nothing published for this version

  17. 3.0.1-alpha-20230220215039-18c86888920 Feb 2023pre-release

    Nothing published for this version

  18. 3.0.1-alpha-20230220203337-a78ca995720 Feb 2023pre-release

    Nothing published for this version

  19. 3.0.1-alpha-20230220195739-6ddf2146320 Feb 2023pre-release

    Nothing published for this version

  20. 3.0.1-alpha-20230220195502-f7639fa7d20 Feb 2023pre-release

    Nothing published for this version

  21. 3.0.1-alpha-20230220195408-c4c8dc71920 Feb 2023pre-release

    Nothing published for this version

  22. 3.0.1-alpha-20230220195308-cf862dc6f20 Feb 2023pre-release

    Nothing published for this version

  23. 3.0.1-alpha-20230220195231-c0353598720 Feb 2023pre-release

    Nothing published for this version

  24. 3.0.1-alpha-20230220141201-44d4498f920 Feb 2023pre-release

    Nothing published for this version

  25. 3.0.1-alpha-20230220141150-d2acdf19420 Feb 2023pre-release

    Nothing published for this version

  26. 3.0.1-alpha-20230220141118-87ded92be20 Feb 2023pre-release

    Nothing published for this version

  27. 3.0.1-alpha-20230220140839-1946419b720 Feb 2023pre-release

    Nothing published for this version

  28. 3.0.1-alpha-20230220124256-b16895d1820 Feb 2023pre-release

    Nothing published for this version

  29. 3.0.1-alpha-20230220124108-dbd546e1e20 Feb 2023pre-release

    Nothing published for this version

  30. 3.0.1-alpha-20230220124003-e8337e29120 Feb 2023pre-release

    Nothing published for this version

  31. 3.0.1-alpha-20230220095758-a9212661720 Feb 2023pre-release

    Nothing published for this version

  32. 3.0.1-alpha-20230220095740-3f3007a2320 Feb 2023pre-release

    Nothing published for this version

  33. 3.0.1-alpha-20230220003012-c1f5e991420 Feb 2023pre-release

    Nothing published for this version

  34. 3.0.1-alpha-20230220002914-3addc34d620 Feb 2023pre-release

    Nothing published for this version

  35. 3.0.1-alpha-20230220002407-eff4e077520 Feb 2023pre-release

    Nothing published for this version

  36. 3.0.1-alpha-20230219101228-e69f2219319 Feb 2023pre-release

    Nothing published for this version

  37. 3.0.1-alpha-20230219101053-5810e94a319 Feb 2023pre-release

    Nothing published for this version

  38. 3.0.1-alpha-20230218173514-243806a7b18 Feb 2023pre-release

    Nothing published for this version

  39. 3.0.1-alpha-20230217214826-53c26884f17 Feb 2023pre-release

    Nothing published for this version

  40. 3.0.1-alpha-20230217161829-8a122700b17 Feb 2023pre-release

    Nothing published for this version

  41. 3.0.1-alpha-20230217161739-638efbd3f17 Feb 2023pre-release

    Nothing published for this version

  42. 3.0.1-alpha-20230217154333-d17414c8017 Feb 2023pre-release

    Nothing published for this version

  43. 3.0.1-alpha-20230217153527-81255679317 Feb 2023pre-release

    Nothing published for this version

  44. 3.0.1-alpha-20230217153118-8e7a4a5bc17 Feb 2023pre-release

    Nothing published for this version

  45. 3.0.1-alpha-20230217145622-77a9e70b417 Feb 2023pre-release

    Nothing published for this version

  46. 3.0.1-alpha-20230217145440-5994e1e4a17 Feb 2023pre-release

    Nothing published for this version

  47. 3.0.1-alpha-20230217145311-1c1e89c5c17 Feb 2023pre-release

    Nothing published for this version

  48. 3.0.1-alpha-20230217145229-f20635e0417 Feb 2023pre-release

    Nothing published for this version

  49. 3.0.1-alpha-20230217145044-d045ac30c17 Feb 2023pre-release

    Nothing published for this version

  50. 3.0.1-alpha-20230217144935-39c5afd6617 Feb 2023pre-release

    Nothing published for this version

  51. 3.0.1-alpha-20230217144901-4ecac000417 Feb 2023pre-release

    Nothing published for this version

  52. 3.0.1-alpha-20230217144456-5442617e517 Feb 2023pre-release

    Nothing published for this version

  53. 3.0.1-alpha-20230217144217-9f556165a17 Feb 2023pre-release

    Nothing published for this version

  54. 3.0.1-alpha-20230217144137-4aef16ada17 Feb 2023pre-release

    Nothing published for this version

  55. 3.0.1-alpha-20230217144033-8c569b29617 Feb 2023pre-release

    Nothing published for this version

  56. 3.0.1-alpha-20230217143712-20d55c8c917 Feb 2023pre-release

    Nothing published for this version

  57. 3.0.1-alpha-20230217143412-17fd2802217 Feb 2023pre-release

    Nothing published for this version

  58. 3.0.1-alpha-20230217143314-d2e5d33fe17 Feb 2023pre-release

    Nothing published for this version

  59. 3.0.1-alpha-20230217102713-032d7d08217 Feb 2023pre-release

    Nothing published for this version

  60. 3.0.1-alpha-20230217093757-462e1a42117 Feb 2023pre-release

    Nothing published for this version