gatsby-source-local-git-modern

2.0.1 • Public • Published

gatsby-source-local-git-modern

npm MIT build

This is a fork and modernized version of gatsby-source-local-git with the aim of keeping up with latest dependency versions and APIs.

A Gatsby source plugin for sourcing data into your Gatsby application from your local git repository. The plugin enables gatsby sites to include meta data about their own git repository at build time.

You can find a running example here: https://using-gatsby-source-local-git.netlify.app/

Missing a feature? Please create an issue (or even a pull request).

Install

npm install --save gatsby-source-local-git-modern

How to use

// In your gatsby-config.js
module.exports = {
  plugins: [`gatsby-source-local-git-modern`],
}

Sources of the example are available at examples/using-gatsby-source-local-git/

How to query

The plugin creates Commit, Tag, Branch and Author nodes.

⚠️ Please be aware that CI platforms might use an optimized strategy to fetch your git repository. Make sure to fetch all history for branches and tags depending on your needs.

Latest commit hash

{
  gitCommit(latest: { eq: true }) {
    hash
  }
}

Latest tag name

{
  gitTag(latest: { eq: true }) {
    name
  }
}

Only tag names including a dot will be considered (like v1.2.3 or 1.2 but not newest-feature).

Current Branches

{
  gitBranch(current: { eq: true }) {
    name
  }
}

Authors

{
  allGitAuthor(sort: { fields: name }) {
    nodes {
      name
      email
    }
    totalCount
  }
}

Package Sidebar

Install

npm i gatsby-source-local-git-modern

Weekly Downloads

0

Version

2.0.1

License

MIT

Unpacked Size

11 kB

Total Files

8

Last publish

Collaborators

  • csharpermantle