0.0.7 • Published 12 months ago

@gwesseling/graphql-codegen v0.0.7

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

GraphQL Codegen

GraphQL Codegen is a powerful tool that helps you create GraphQL schemas using JSON. With an input schema based on the GraphQL type API, it should feel familiar to most users.

image

Installation

You can install graphql-codegen by running one of the commands below:

# npm
npm install @gwesseling/graphql-codegen

# yarn
yarn add @gwesseling/graphql-codegen

# pnpm
pnpm install @gwesseling/graphql-codegen

Usage

The usage of this package is straightforward.

import {codegen} from "@gwesseling/graphql-codegen";

// Using the default config
codegen()
    .then((result) => console.log(result))
    .catch((err) => console.log(err));

or

import {codegen} from "@gwesseling/graphql-codegen";

// Using a custom config
codegen({
    inputFile: "input.json",
    outputFile: "schema.ts",
})
    .then((result) => console.log(result))
    .catch((err) => console.log(err));

For a complete input examples, please refer to the examples folder. This folder contains a comprehensive JSON input, as well as the resulting output generated by the tool.

Options

GraphQL-Codegen accepts the following options:

OptionDescriptionTypeDefault
inputFilePath to a file containing a JSON schemastringschema.json
outputFileOutput file for the schemastringschema.js
0.0.3

1 year ago

0.0.2

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.7

12 months ago

0.0.6

1 year ago

0.0.1

1 year ago