Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nilportugues/graphql-data-access-generator
Generate all queries, mutation, subscriptions, fragments and types for any GraphQL schema
https://github.com/nilportugues/graphql-data-access-generator
code-generation gql gqlgen graphl-typescript graphql graphql-code-generator graphql-fragments graphql-query-generator graphql-schema graphql-subcriptions graphql-types typescript
Last synced: about 1 month ago
JSON representation
Generate all queries, mutation, subscriptions, fragments and types for any GraphQL schema
- Host: GitHub
- URL: https://github.com/nilportugues/graphql-data-access-generator
- Owner: nilportugues
- Created: 2022-06-08T19:55:23.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-15T20:46:45.000Z (over 2 years ago)
- Last Synced: 2024-10-12T13:20:20.305Z (2 months ago)
- Topics: code-generation, gql, gqlgen, graphl-typescript, graphql, graphql-code-generator, graphql-fragments, graphql-query-generator, graphql-schema, graphql-subcriptions, graphql-types, typescript
- Language: TypeScript
- Homepage:
- Size: 83 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GraphQL Data Access Generator
This project's goal is to generate all queries, mutation, subscriptions, fragments and types for any GraphQL schema.
## Installation
This is a development tool, so make sure you install it with `--save-dev` or `-D`.
```
npm install graphql-data-access-generator --save-devyarn add -D graphql-data-access-generator
```## Demo
All code generation can be demo'd by looking into the [example directory](https://github.com/nilportugues/graphql-data-access-generator/tree/main/example)## Usage
1. Provide a `graphqlUrl` and optionally the required headers to authenticate.
2. Provide a `schemaFile` location to download the current GraphQL schema.
3. Provide a `destinationPath` where all generated code will be outputed (it will be TypeScript).```js
const generator = require('graphql-data-access-generator')async function main () {
await generator({
graphqlUrl: "http://0.0.0.0:8055/graphql",
schemaFile: "/tmp/schema.graphql",
headers: {
"Authorization": "Bearer graphql-admin"
},
destinationPath: __dirname + "/generated",
});
}main()
```## Distribution file
The current bundle size for this repository is `3.9MB`. All of it belongs to `dist/index.js`.
The reason behind this file size is we're using `@vercel/ncc` to generate one file with all the dependencies embedded to the generated `dist/index.js` file. This makes this package have no real dependencies when being installed in your project.
Working with this approach enables us to use this piece of software today and in the future, as we can guarantee it will not collide with different library versions and breaking changes that could potentally be introduced in the future.