Socket
Socket
Sign inDemoInstall

gatsby-theme-github-stats

Package Overview
Dependencies
10
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gatsby-theme-github-stats

A Gatsby Theme to display statistics for GitHub repos.


Version published
Weekly downloads
3
increased by50%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Gatsby-theme-github-stats

A Gatsby Theme to display statistics for GitHub repos.

Example site for theme using gatsby as data

Example Site

you can see a live running example site at https://gatsby-theme-github-stats-example.netlify.com/.

This is the gatsby site in this repo at site deployed up to Netlify.

Features

  • Charts with Recharts library

Setup

Add the package to your gatsby site

yarn add gatsby-theme-github-stats

and then put it in your gatsby-config file

module.exports = {
  siteMetadata: {
    title: '<title for page>'
    source: '<GitHub URL for your site>'
    repoNameWithOwner: '<github owner & repo in format of `owner/repo`>'
  }
  plugins: [
    {
      resolve: `gatsby-theme-github-stats`,
      options: {
        dataPath: path.join(__dirname, `src`, `data`),
      },
    },
  ],
}

Next, create a file at src/data/data.json in your gatsby site and have it as the following format:

[
  {
    "stars": 35670,
    "openPRs": 84,
    "timestamp": 1560977138,
    "closedIssues": 6355,
    "closedPRs": 1094,
    "openIssues": 442,
    "mergedPRs": 6947
  }
]

Each item is a single datapoint. There is no max amount of datapoints you can have.

Then finally run yarn develop and you should see the fully fleshed out site with graphs and all.

Config Options

These are all of the currently available fields in the options field in the gatsby-config plugin entry for this theme:

NameDescriptionDefaultRequired
basePathurl base path for the dashboard page to be created at (ex: '/stats/')'/'false
dataPaththe filepath to your data directoryN/Atrue

Site Metadata

Some of the text around the site is customized by siteMetadata tokens.

NameDescriptionExamplerequired
titleTitle at the top left of the page and the <title> tagGatsby Statstrue
sourceurl to source of the Gatsby sitehttps://github.com/lannonbr/gatsby-github-statsfalse
repoNameWithOwnerusername & repo name on GitHubgatsbyjs/gatsbyfalse

Keywords

FAQs

Last updated on 06 Mar 2021

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc