{"name":"gatsby-source-github","description":"A gatsby source plugin to source Github's GraphQL API for build-time data for Gatsby","version":"0.0.1","main":"index.js","author":{"name":"Dustin Schau","email":"dustinschau@gmail.com","url":"https://dustinschau.com"},"repository":{"type":"git","url":"https://github.com/DSchau/gatsby-source-github.git"},"license":"MIT","keywords":["gatsby","gatsby-plugin","gatsby-source-plugin"],"devDependencies":{"babel-cli":"~6.26.0","babel-plugin-transform-object-rest-spread":"~6.26.0","babel-preset-env":"~1.6.1","cross-env":"~5.1.4","husky":"~0.14.3","jest":"~22.4.3","prettier":"~1.11.1","pretty-quick":"~1.4.1"},"scripts":{"precommit":"pretty-quick --staged","build":"babel src --out-dir . --ignore __tests__","prepublishOnly":"cross-env NODE_ENV=production npm run build","test":"jest","watch":"babel -w src --out-dir . --ignore __tests__"},"dependencies":{"graphql-request":"~1.5.1","lodash":"~4.17.5","yup":"~0.24.1"},"_id":"gatsby-source-github@0.0.1","dist":{"shasum":"51754409cfea2b1a03c89f4da31cea30b7e61b5f","tarball":"http://registry-npm.ywwl.com/gatsby-source-github/download/gatsby-source-github-0.0.1.tgz","fileCount":10,"unpackedSize":8410,"integrity":"sha512-nHS71hu9tmDcfoOlT69NLWwutXe6EFnRMZUA7boiT2dA1XRzVWrfYp1EgLDpQqzGs/U9oeGh1Z5dKS2jQMsoGA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAbVolM0/1pMP/w84+4QIpaQxX6lTclbs2sccn6yuWjeAiAcNkJ03Oz+9267wyiz56vxuvz1wg18iBK2X4xtk4drdg=="}],"size":3646,"noattachment":false,"key":"/gatsby-source-github/-/gatsby-source-github-0.0.1.tgz"},"maintainers":[{"email":"dustinschau@gmail.com","name":"dschau"},{"email":"accounts@resin.io","name":"resin.io"}],"_npmUser":{"name":"dschau","email":"dustinschau@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gatsby-source-github_0.0.1_1522341295028_0.7945581862899116"},"_hasShrinkwrap":false,"deprecated":"Please use gatsby-source-graphql instead with schema stitching","readme":"# gatsby-source-github\n\n[![Build Status](https://travis-ci.org/DSchau/gatsby-source-github.svg?branch=master)](https://travis-ci.org/DSchau/gatsby-source-github)\n\nSource plugin for pulling in Github data (using its [GraphQL API][github-api]) at buildtime for static generation and further GraphQL querying with Gatsby\n\n## Install\n\n```bash\nnpm install gatsby-source-github --save-dev\n```\n\n## How to use\n\nIn your `gatsby-config.js`:\n\n```javascript\nplugins: [\n  {\n    resolve: 'gatsby-source-github',\n    options: {\n      headers: {\n        Authorization: `Bearer YOUR_GITHUB_PERSONAL_ACCESS_TOKEN`, // https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/\n      },\n      queries: [\n        `{\n          repository(owner: \"nebraskajs\", name: \"speaker-signup\") {\n            issues(last: 20, states: OPEN) {\n              edges {\n                node {\n                  id\n                  author {\n                    avatarUrl\n                    login\n                    url\n                  }\n                  bodyHTML\n                  title\n                  url\n                }\n              }\n            }\n          }\n        }`,\n      ],\n    },\n  },\n];\n```\n\n`queries` is an array of GraphQL queries. The algorithm to generate Gatsby GraphQL nodes is described [below](#the-algorithm)\n\n## How to query\n\nIn general, use the [Github API v4 documentation][github-api] and in particular, the [explorer][explorer] to craft your queries and refer to the the [below algorithm](#the-algorithm) for how to query against these results with Gatsby.\n\n### Using variables\n\nAdditionally, variables can be used/injectd into the queries. Rather than sending a string in the queries array, send an array like so:\n\n```javascript\n[\n  `query getViewer($first: Int!) {\n    viewer {\n      login\n      name\n      repositories(first:$first) {\n        edges {\n          node {\n            name\n          }\n        }\n      }\n    }\n  }`,\n  { first: 10 },\n];\n```\n\n### The algorithm\n\nThe algorithm is quite simple. It'll descend through the tree/returned structure, and if it finds an `edges` key will use the parent of that as the node name. For instance, in the above `repository` example, `githubIssue` will be the node name, and `allGithubIssues` will be the way to query against all nodes. In the `viewer` example the node name will be `githubViewer`.\n\nAll fields in the node that are queried against in the Github GraphQL query are available to be queried with Gatsby. For example, in the `repository` example above, `id`, `author` (and subfields), `bodyHTML`, etc. are available to be queried against.\n\n[github-api]: https://developer.github.com/v4/\n[explorer]: https://developer.github.com/v4/explorer/\n","publish_time":1522341295080,"_cnpm_publish_time":1522341295080,"dist-tags":{"canary":"0.0.0-alpha.c2e09d90-alpha.ac9438ae-alpha.ac9438ae","latest":"0.0.2"}}