UNPKG

4.7 kBMarkdownView Raw
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
23Refer to the full [documentation](https://sgts.netlify.com) !
24
25## **Installation**
26
27For global use
28
29```bash
30npm i -g simple-graphql-to-typescript
31#or
32yarn global add simple-graphql-to-typescript
33```
34
35For local use
36
37```bash
38npm i simple-graphql-to-typescript --save-dev
39#or
40yarn add -D simple-graphql-to-typescript
41```
42
43## Help
44
45```bash
46sgts -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-vue-hooks | | boolean | [See doc](https://sgts.netlify.com/options/codegen-react-hooks.html) |
59| --codegen-templates | | boolean | [See doc](https://sgts.netlify.com/options/withGqlQueries.html) |
60| --customScalars `<scalars>` | | {"myScalar": "MyType"} | [See doc](https://sgts.netlify.com/options/customScalars.html) |
61| --prefix `<prefix>` | -p | string <br> _default_ `null` | [See doc](https://sgts.netlify.com/options/prefix.html) |
62| --suffix `<suffix>` | -s | string <br> _default_ `null` | [See doc](https://sgts.netlify.com/options/suffix.html) |
63| --header `<header>` | | string <br> _default_ `null` | [See doc](https://sgts.netlify.com/options/header.html) |
64| --compileToJs | | boolean | [See doc](https://sgts.netlify.com/options/jsMode.html) |
65| --download | -D | string <br> _default_ `null` | [See doc](https://sgts.netlify.com/options/download.html) |
66| generate | | string <br> _default_ `development` | [See doc](https://sgts.netlify.com/configuration/config.html) |
67| init | | | [See doc](https://sgts.netlify.com/configuration/init.html) |
68
69## Roadmap
70
71I don't have much free time to develop feature I don't use, but feel free to send a PR!
72
73- [x] Export only Gql string
74- [x] Removed Query and mutation name in Apollo Hooks data
75- [x] Config file `.sgtsrc.js`
76- [x] Support Subscriptions for codegen-react-hooks
77- [x] Support Subscriptions for codegen-vue-hooks
78- [x] Support Subscriptions for codegen-template
79- [ ] Support Subscriptions for codegen-methods
80- [ ] Support UseLazyQuery Apollo Hook
81- [ ] Highlight new generated, modified or deleted types in terminal
82
83# License
84
85MIT
86
87Victor Garcia