{"name":"gatsby-source-github","version":"0.0.0-beta1.2","description":"Gatsby source plugin for github repo API","main":"index.js","scripts":{"build":"babel lib --out-dir dist","watch":"babel -w lib --out-dir dist"},"repository":{"type":"git","url":"git+https://github.com/resin-io/landr.git"},"keywords":["landr","static-site","gatsby"],"dependencies":{"github":"9.2.0","lodash":"4.17.4"},"author":{"name":"craig-mulligan"},"license":"ISC","bugs":{"url":"https://github.com/resin-io/landr/issues"},"homepage":"https://github.com/resin-io/landr#readme","_id":"gatsby-source-github@0.0.0-beta1.2","_shasum":"b2111bbdcab712e549c6c7298200c321d721ab85","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.0","_npmUser":{"name":"resin.io","email":"accounts@resin.io"},"dist":{"shasum":"b2111bbdcab712e549c6c7298200c321d721ab85","tarball":"http://registry-npm.ywwl.com/gatsby-source-github/download/gatsby-source-github-0.0.0-beta1.2.tgz","integrity":"sha512-SYvJVDZ0dGD4Tw5LRqIMufcy7fYFMencScrkT2SgfNww7QUXfMoF64BBc0MQnwuGoDzkxnYNEd1MWxxeQSvn2Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE49zpEHtPN1sqb4sN2s1dZeOnmuWpJP0yl7YhIaH/qbAiEAnaWY9mwvrXzmMzocMF94uZSc/wqhizz7VnUr2GXa1Dc="}],"size":3572,"noattachment":false,"key":"/gatsby-source-github/-/gatsby-source-github-0.0.0-beta1.2.tgz"},"maintainers":[{"name":"resin.io","email":"accounts@resin.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gatsby-source-github-0.0.0-beta1.2.tgz_1502116702679_0.018748042406514287"},"directories":{},"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":1502116703575,"_cnpm_publish_time":1502116703575,"dist-tags":{"canary":"0.0.0-alpha.c2e09d90-alpha.ac9438ae-alpha.ac9438ae","latest":"0.0.2"}}