1.1.0 • Published 4 months ago

@eddeee888/nx-graphql-code-generator v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@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>
OptionsRequiredDescription
projectYesNx project to add codegen config to
schemaYesMaps to codegen's schema field
outputNoOutput path for the generated path. Relative from project root. More can be added manually later. Default: graphql/generated.ts
documentNoMaps to codegen's documents field
pluginPresetNoCommon codegen plugins presets depending on project language, use cases and libraries
configNoName 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>
OptionsRequiredDescription
configFileYesPath to the project's codegen config file
watchNoRun codegen in watch mode