Skip to content

Commit 90bccde

Browse files
committed
feat(readme): Added readme
1 parent ca721df commit 90bccde

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Vue GraphQL Inject
2+
3+
A simple way to use your GraphQL operations in a type-safe way with Vue!
4+
It uses [graphql-code-generator](https://github.com/dotansimha/graphql-code-generator) to generate the types everything.
5+
6+
### Quick start
7+
As this package is dependent on [graphql-code-generator](https://github.com/dotansimha/graphql-code-generator) you may first install it and create a config for it.
8+
[Here](https://github.com/dotansimha/graphql-code-generator#quick-start) is a guide on how to do that.
9+
10+
As soo as you're ready you can continue to setup this package.
11+
First of all you need to [install it](#setup) with your preferred package manager.
12+
13+
The *graphql-code-generator* plugin can be found under `vue-graphql-inject/lib/codegen`.
14+
You may add a new output file specifically for this plugin. For example:
15+
```yaml
16+
schema: "http://localhost:3000/graphql"
17+
documents: "**/*.graphql"
18+
generates:
19+
src/generated/graphql-inject.ts:
20+
- "vue-graphql-inject/lib/codegen"
21+
```
22+
23+
The next step is to add the `Vue` plugin:
24+
```javascript
25+
import Vue from 'vue'
26+
import { VueGraphQLInject } from 'vue-graphql-inject/lib/vue'
27+
import { GraphQLInjectDefinition } from './generated/graphql-inject.ts'
28+
29+
Vue.use(VueGraphQLInject, { definition: GraphQLInjectDefinition })
30+
```
31+
32+
# Setup
33+
With NPM:
34+
```
35+
$ npm install vue-graphl-inject
36+
```
37+
38+
With Yarn:
39+
```
40+
$ yarn add vue-graphql-inject
41+
```

0 commit comments

Comments
 (0)