1 | # Simple-graphql-to-typescript generator
|
2 |
|
3 | <p align="center">
|
4 | <a href='https://sgts.netlify.com/'>
|
5 | <img width='100' src="./media/logo.png" alt="sgts logo">
|
6 | </a>
|
7 | </p>
|
8 |
|
9 | [![npm version][npm-version-src]][npm-version-href]
|
10 | [![npm downloads][npm-downloads-src]][npm-downloads-href]
|
11 | [![npm downloads][npm-total-downloads-src]][npm-downloads-href]
|
12 | <img src='https://img.shields.io/github/workflow/status/victorgarciaesgi/simple-graphql-to-typescript/Node.js%20CI'>
|
13 | <img src='https://img.shields.io/npm/l/simple-graphql-to-typescript.svg'>
|
14 |
|
15 | [npm-version-src]: https://img.shields.io/npm/v/simple-graphql-to-typescript.svg
|
16 | [npm-version-href]: https://www.npmjs.com/package/simple-graphql-to-typescript
|
17 | [npm-downloads-src]: https://img.shields.io/npm/dm/simple-graphql-to-typescript.svg
|
18 | [npm-total-downloads-src]: https://img.shields.io/npm/dt/simple-graphql-to-typescript.svg
|
19 | [npm-downloads-href]: https://www.npmjs.com/package/simple-graphql-to-typescript
|
20 |
|
21 | ## Usage
|
22 |
|
23 | Refer to the full [documentation](https://sgts.netlify.com) !
|
24 |
|
25 | ## **Installation**
|
26 |
|
27 | For global use
|
28 |
|
29 | ```bash
|
30 | npm i -g simple-graphql-to-typescript
|
31 | #or
|
32 | yarn global add simple-graphql-to-typescript
|
33 | ```
|
34 |
|
35 | For local use
|
36 |
|
37 | ```bash
|
38 | npm i simple-graphql-to-typescript --save-dev
|
39 | #or
|
40 | yarn add -D simple-graphql-to-typescript
|
41 | ```
|
42 |
|
43 | ## Help
|
44 |
|
45 | ```bash
|
46 | sgts -h
|
47 | ```
|
48 |
|
49 | ## **Documentation**
|
50 |
|
51 | | Option | Short syntax | Type | Usage |
|
52 | | --------------------------- | ------------ | -------------------------------------------- | -------------------------------------------------------------------- |
|
53 | | --endpoint `<endpoint>` | -e | string(url) | [See doc](https://sgts.netlify.com/options/endpoint.html) |
|
54 | | --json `<path to json>` | -j | string(path) | [See doc](https://sgts.netlify.com/options/json.html) |
|
55 | | --output `<path>` | -o | string(path) <br> _default_ `./generated.ts` | [See doc](https://sgts.netlify.com/options/output.html) |
|
56 | | --codegen-methods | | boolean | [See doc](https://sgts.netlify.com/options/codegen-methods.html) |
|
57 | | --codegen-react-hooks | | boolean | [See doc](https://sgts.netlify.com/options/codegen-react-hooks.html) |
|
58 | | --codegen-templates | | boolean | [See doc](https://sgts.netlify.com/options/withGqlQueries.html) |
|
59 | | --customScalars `<scalars>` | | {"myScalar": "MyType"} | [See doc](https://sgts.netlify.com/options/customScalars.html) |
|
60 | | --prefix `<prefix>` | -p | string <br> _default_ `null` | [See doc](https://sgts.netlify.com/options/prefix.html) |
|
61 | | --suffix `<suffix>` | -s | string <br> _default_ `null` | [See doc](https://sgts.netlify.com/options/suffix.html) |
|
62 | | --header `<header>` | | string <br> _default_ `null` | [See doc](https://sgts.netlify.com/options/header.html) |
|
63 | | --compileToJs | | boolean | [See doc](https://sgts.netlify.com/options/jsMode.html) |
|
64 | | --download | -D | string <br> _default_ `null` | [See doc](https://sgts.netlify.com/options/download.html) |
|
65 | | --generate | | string <br> _default_ `development` | [See doc](https://sgts.netlify.com/configuration/config.html) |
|
66 |
|
67 | ## Roadmap
|
68 |
|
69 | I don't have much free time to develop feature I don't use, but feel free to send a PR!
|
70 |
|
71 | - [x] Export only Gql string
|
72 | - [x] Removed Query and mutation name in Apollo Hooks data
|
73 | - [x] Config file `.sgtsrc.js`
|
74 | - [ ] Support Subscriptions for codegen-hooks and codegen-methods
|
75 | - [ ] Support UseLazyQuery Apollo Hook
|
76 | - [ ] Highlight new generated, modified or deleted types in terminal
|
77 |
|
78 | # License
|
79 |
|
80 | MIT
|
81 |
|
82 | Victor Garcia
|