@eddeee888/nx-graphql-code-generator
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@eddeee888/nx-graphql-code-generator

This Nx plugin can be used to add graphql-code-generator config and packages to an Nx project.

Generators

add

You can use this generator to wire up codegen config to an Nx project.

$ nx generate @eddeee888/nx-graphql-code-generator --project=<existing project name>
Options Required Description
project Yes Nx project to add codegen config to
schema Yes Maps to codegen's schema field
output No Output path for the generated path. Relative from project root. More can be added manually later. Default: graphql/generated.ts
document No Maps to codegen's documents field
pluginPreset No Common codegen plugins presets depending on project language, use cases and libraries
config No Name of codegen config file. Default: graphql-codegen.ts

Executors

codegen

You can use this executor to run codegen CLI. Note that the add generator automatically adds this to the project config. Your project config should look like this:

// libs/<project name>/project.json
{
  // ...
  "targets": {
    // ...
    "graphql-codegen": {
      "executor": "@eddeee888/nx-graphql-code-generator:codegen",
      "options": {
        "configFile": "libs/<project name>/codegen.yml"
      }
    }
  }
}

You can run the executor like you woud other targets:

$ nx graphql-codegen <project name>
Options Required Description
configFile Yes Path to the project's codegen config file
watch No Run codegen in watch mode

/@eddeee888/nx-graphql-code-generator/

    Package Sidebar

    Install

    npm i @eddeee888/nx-graphql-code-generator

    Weekly Downloads

    13

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    34.3 kB

    Total Files

    32

    Last publish

    Collaborators

    • eddeee888