gatsby-source-github-api
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -28,3 +28,6 @@ const { fetchFromGithub } = require("./src/helper"); | ||
.digest(`hex`), | ||
mediaType: "application/json" | ||
// see https://github.com/ldd/gatsby-source-github-api/issues/10 | ||
// our node should have an 'application/json' MIME type, but we wish | ||
// transformers to ignore it, so we set its mediaType to text/plain for now | ||
mediaType: "text/plain" | ||
} | ||
@@ -31,0 +34,0 @@ }); |
{ | ||
"name": "gatsby-source-github-api", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "gatsby plugin for github v4 API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# gatsby-source-github-api | ||
Source plugin for pulling data into Gatsby from the official GitHub v4 [GraphQL API](https://developer.github.com/v4/). | ||
## Install | ||
`npm i gatsby-source-github-api` | ||
## How to use | ||
Follow GitHub's guide [how to generate a token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/). | ||
@@ -13,2 +16,3 @@ | ||
In there, you want to add this plugin and at least add the token in the options object: | ||
```javascript | ||
@@ -22,6 +26,6 @@ // In your gatsby-config.js | ||
token: someString, | ||
// GraphQLquery: defaults to a search query | ||
graphQLQuery: anotherString, | ||
// variables: defaults to variables needed for a search query | ||
@@ -31,3 +35,3 @@ variables: someObject | ||
} | ||
] | ||
]; | ||
``` | ||
@@ -38,2 +42,3 @@ | ||
**Search query:** | ||
```javascript | ||
@@ -45,3 +50,3 @@ // In your gatsby-config.js | ||
options: { | ||
token: 'hunter2', | ||
token: "hunter2", | ||
variables: { | ||
@@ -53,5 +58,7 @@ q: "author:ldd state:closed type:pr sort:comments", | ||
} | ||
] | ||
]; | ||
``` | ||
resulting API call: | ||
```graphql | ||
@@ -72,2 +79,3 @@ query ($nFirst: Int, $q: String) { | ||
**Custom GraphQL query:** | ||
```javascript | ||
@@ -79,3 +87,3 @@ // In your gatsby-config.js | ||
options: { | ||
token: 'hunter2', | ||
token: "hunter2", | ||
variables: {}, | ||
@@ -91,11 +99,13 @@ graphQLQuery: ` | ||
} | ||
] | ||
]; | ||
``` | ||
resulting API call: | ||
```graphql | ||
query { | ||
repository(owner:"torvalds", name:"linux"){ | ||
description | ||
} | ||
query { | ||
repository(owner: "torvalds", name: "linux") { | ||
description | ||
} | ||
} | ||
``` | ||
@@ -113,6 +123,9 @@ | ||
v0.1.2 Updated `yarn.lock` to address github security warnings | ||
v0.1.1 Updated Readme for easier usage | ||
v0.1.0 Submit to Gatsby's Plugin Library | ||
v0.0.4 Update dev dependencies, add linting script to package.json | ||
v0.0.3 Initial public release | ||
- `v0.1.3` | ||
- Change mediaType of exported node to be ignored by `gatsby-transformer-json` | ||
- prettify changelog of this file | ||
- `v0.1.2` Updated `yarn.lock` to address github security warnings | ||
- `v0.1.1` Updated Readme for easier usage | ||
- `v0.1.0` Submit to Gatsby's Plugin Library | ||
- `v0.0.4` Update dev dependencies, add linting script to package.json | ||
- `v0.0.3` Initial public release |
6741
72
122