Socket
Book a DemoInstallSign in
Socket

gatsby-source-github-gql

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-source-github-gql

Gatsby Source plugin for pulling in data from the GitHub GraphQL api

0.1.0
latest
npmnpm
Version published
Maintainers
1
Created
Source

gatsby-source-github-gql (beta)

Pull any data from the github graphql api.

Note: Currently only supports single queries and no nested collections.

Setup

To get started install via yarn or npm:

yarn add gatsby-source-github-gql

Then configure in your gatsby-config.js file:

module.exports = {
  //...
  plugins: [
    //...,
    {
      resolve: "gatsby-source-github-gql",
      options: {
        auth: YOUR_GITHUB_TOKEN,
        query: `{
          viewer {
            name
            repositories(last: 10) {
              edges {
                node {
                  id
                  name
                  url
                  description
                }
              }
            }
          }
        }
        `
      }
    }
  ]
}

Accessing the data in Gatsby

The Gatsby queries will be dependent on the content of the data you're pulling in from github, but this plugin attempts to keep collection names consistent. For example: repositories in a query to the GitHub API will become allRepositories when accessing Gatsby's data. The above example can be accessed as:

{
allRepositories {
  edges {
    node {
      id
      name
      url
      description
    }
  }
}

Keywords

gatsby

FAQs

Package last updated on 08 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.