Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-codegen/near-operation-file-preset

Package Overview
Dependencies
Maintainers
4
Versions
3879
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-codegen/near-operation-file-preset

GraphQL Code Generator preset for generating operation code near the operation file

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
445K
increased by2.84%
Maintainers
4
Weekly downloads
 
Created

What is @graphql-codegen/near-operation-file-preset?

@graphql-codegen/near-operation-file-preset is a preset for GraphQL Code Generator that generates TypeScript/Flow types for your GraphQL operations and fragments near the file where they are used. This helps in keeping the generated types close to the actual usage, making it easier to manage and maintain.

What are @graphql-codegen/near-operation-file-preset's main functionalities?

Generate TypeScript types for GraphQL operations

This configuration generates TypeScript types for GraphQL operations and fragments, placing the generated types near the operation files. The `baseTypesPath` specifies the path to the base types.

{
  "schema": "./schema.graphql",
  "documents": "./src/**/*.graphql",
  "generates": {
    "./src/": {
      "preset": "near-operation-file",
      "presetConfig": {
        "baseTypesPath": "types/graphql.d.ts"
      },
      "plugins": [
        "typescript",
        "typescript-operations"
      ]
    }
  }
}

Generate Flow types for GraphQL operations

This configuration generates Flow types for GraphQL operations and fragments, placing the generated types near the operation files. The `baseTypesPath` specifies the path to the base types.

{
  "schema": "./schema.graphql",
  "documents": "./src/**/*.graphql",
  "generates": {
    "./src/": {
      "preset": "near-operation-file",
      "presetConfig": {
        "baseTypesPath": "types/graphql.js"
      },
      "plugins": [
        "flow",
        "flow-operations"
      ]
    }
  }
}

Custom file extension for generated files

This configuration allows you to specify a custom file extension for the generated files. In this example, the generated files will have a `.generated.tsx` extension.

{
  "schema": "./schema.graphql",
  "documents": "./src/**/*.graphql",
  "generates": {
    "./src/": {
      "preset": "near-operation-file",
      "presetConfig": {
        "extension": ".generated.tsx",
        "baseTypesPath": "types/graphql.d.ts"
      },
      "plugins": [
        "typescript",
        "typescript-operations"
      ]
    }
  }
}

Other packages similar to @graphql-codegen/near-operation-file-preset

FAQs

Package last updated on 25 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc