1.10.1 • Published 5 years ago

gql2ts v1.10.1

Weekly downloads
9,175
License
MIT
Repository
github
Last release
5 years ago

GQL2TS

npm install -g gql2ts
Usage: index [options] <schema.json | schema.gql> <query.gql>

Options:

  -h, --help                         output usage information
  -V, --version                      output the version number
  -o --output-file [outputFile]      name for output file, will use stdout if not specified
  -n --namespace [namespace]         name for the namespace, defaults to "GQL"
  -i --ignored-types <ignoredTypes>  names of types to ignore (comma delimited)
  -l --legacy                        Use TypeScript 1.x annotation
  -e --external-options              ES Module with method overwrites

Usage Explanation

Schema can be inputted via a file or stdin and formatted as either JSON (Introspection Query result) or GraphQL Schema Language.

If a query.gql file is specified, gql2ts will run the query against the schema and generate interfaces based on that. If no query is specified, gql2ts will create a namespace for your schema and add the interfaces to there.

For -e or --external-options, the input should be either an ES Module with a default export or a CommonJS Module that defines a language package (default: @gql2ts/language-typescript) or overrides for a language. The interface for this file (export default Partial<IFromQueryOption>) can be found in @gql2ts/types.

Examples

With Default Options

# outputs to stdout
gql2ts schema.json
# outputs to file graphql.d.ts
gql2ts schema.json -o graphql.d.ts

With Optional Options

gql2ts -n Avant -i BadInterface,BadType,BadUnion -o avant-gql.d.ts schema.json

With stdin

cat schema.json | gql2ts
2.0.0-3

5 years ago

2.0.0-2

6 years ago

2.0.0-1

6 years ago

2.0.0-0

6 years ago

1.10.1

6 years ago

1.10.0

6 years ago

1.9.0

6 years ago

1.8.2

6 years ago

1.8.2-0

6 years ago

1.8.1

6 years ago

1.8.0

6 years ago

1.7.2

6 years ago

1.7.2-4

6 years ago

1.7.2-y.0

6 years ago

1.7.2-1

6 years ago

1.7.2-0

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.0

6 years ago

1.6.0-2

6 years ago

1.6.0-1

6 years ago

1.6.0-0

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.4

6 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.0

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

1.0.0-alpha.7

7 years ago

1.0.0-alpha.6

7 years ago

1.0.0-alpha.5

7 years ago

1.0.0-alpha.4

7 years ago

1.0.0-alpha.3

7 years ago

1.0.0-alpha.2

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago