0.0.8 • Published 9 months ago

@nanolier/typescript-graphql-schema-type-generator v0.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

Typescript Graphql Schema Type Generator

🐈 CLI tool to create Type Alias for TypeScript from GraphQL schema

Getting Started

Install

Install the library.

npm i -D @nanolier/typescript-graphql-schema-type-generator

Add to scripts in package.json.

{
  "scripts": {
    "tgstgen": "tgstgen"
  }
}

Create Type Alias File

npm run tgstgen

By default, "./schema.graphql" is read and "./src/__generated__/schema.graphql.ts". To change this, specify the file to be read and the output destination as arguments when executing the command.

npm run tgstgen --schema=.example-dir/schema.gql --output=./example-dir/__generated__/schema.graphql.ts 

or

{
  "scripts": {
    "tgstgen": "tgstgen --schema=.example-dir/schema.gql --output=./example-dir/__generated__/schema.graphql.ts "
  }
}

CLI Options

schema

The relative path to the GraphQL schema file to be used.

tgstgen --schema=.example-dir/schema.gql

output

The relative path to the TypeScript type file to be generated.

tgstgen --schema=.example-dir/schema.gql

nullableType

When nullableType=relay, nullable values will have the type null | undefined. When nullableType=relay-classic, nullable values will have the type null only.

tgstgen --nullableType=relay

noFutureProofEnums

When set to true, the generated enum types will include a %future added value.

tgstgen --noFutureProofEnums=true

onlyEnum

When set to true, only the enum types will be generated.

tgstgen --onlyEnum=false
0.0.8

9 months ago

0.0.7

1 year ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago