Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sibelius/graphql2ts
Transform .graphql to graphql-js typescript
https://github.com/sibelius/graphql2ts
ast code-first codemod graphql
Last synced: 3 months ago
JSON representation
Transform .graphql to graphql-js typescript
- Host: GitHub
- URL: https://github.com/sibelius/graphql2ts
- Owner: sibelius
- Created: 2019-07-15T11:44:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T13:46:46.000Z (about 2 years ago)
- Last Synced: 2024-10-19T19:54:22.788Z (3 months ago)
- Topics: ast, code-first, codemod, graphql
- Language: TypeScript
- Homepage:
- Size: 1.25 MB
- Stars: 41
- Watchers: 2
- Forks: 1
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - graphql2ts - Transform .graphql to graphql-js typescript (TypeScript)
- awesome-codemods - graphql2ts - Transform .graphql to graphql-js typescript. (Misc / ant-design)
README
# graphql2ts
# ![graphql2ts Logo](/img/logo.png)
Transform .graphql files to graphql-js typescript code
## History
We first had [graphql-js](https://github.com/graphql/graphql-js) implementation, but developers weren't happy with it.
So it was born schema first with [graphql-tools](), [merge-graphql-schemas](https://github.com/Urigo/merge-graphql-schemas), [graphql-modules](https://github.com/Urigo/graphql-modules).There is also a codemod to transform your .js files to .graphql files:
[jscodeshift-graphql-files](https://github.com/withspectrum/jscodeshift-graphql-files).After a lot of time, schema first showed some scaling problems, [Schema First Problems](https://www.prisma.io/blog/the-problems-of-schema-first-graphql-development-x1mn4cb0tyl3), mostly because it does not colocate schema with resolvers, and code is much more powerful to implement abstraction on top of it.
This codemod exists to helps us move back to code first approach (graphql-js and related tools).
It will transform a .graphql file and transform in a graphql-js .ts declartion
## How to run
```bash
npx graphql2ts myschema.graphql mySchemaOutput.ts
```## How to test
```
yarn jest
```