Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/PMudra/gatsby-source-local-git
Gatsby source plugin which sources data from your local git repository
https://github.com/PMudra/gatsby-source-local-git
gatsby git graphql plugin
Last synced: 3 days ago
JSON representation
Gatsby source plugin which sources data from your local git repository
- Host: GitHub
- URL: https://github.com/PMudra/gatsby-source-local-git
- Owner: PMudra
- License: mit
- Created: 2019-11-10T18:12:50.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T00:01:46.000Z (over 1 year ago)
- Last Synced: 2024-04-23T21:36:44.897Z (7 months ago)
- Topics: gatsby, git, graphql, plugin
- Language: JavaScript
- Homepage: https://using-gatsby-source-local-git.netlify.app/
- Size: 12.4 MB
- Stars: 8
- Watchers: 1
- Forks: 3
- Open Issues: 43
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# gatsby-source-local-git
[![npm](https://img.shields.io/npm/v/gatsby-source-local-git?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/gatsby-source-local-git)
[![MIT](https://img.shields.io/github/license/pmudra/gatsby-source-local-git?style=for-the-badge)](https://github.com/PMudra/gatsby-source-local-git/blob/master/LICENSE)
[![build](https://img.shields.io/github/workflow/status/PMudra/gatsby-source-local-git/Node%20CI?logo=github&style=for-the-badge)](https://github.com/PMudra/gatsby-source-local-git/actions)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
```shell
npm install --save gatsby-source-local-git
```## How to use
```javascript
// In your gatsby-config.js
module.exports = {
plugins: [`gatsby-source-local-git`],
}
```Sources of the [example](https://using-gatsby-source-local-git.netlify.app/) are available at [examples/using-gatsby-source-local-git/](examples/using-gatsby-source-local-git/)
## How to query
The plugin creates `Commit`, `Tag`, `Branch` and `Author` nodes.
:warning: 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
```graphql
{
gitCommit(latest: { eq: true }) {
hash
}
}
```### Latest tag name
```graphql
{
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
```graphql
{
gitBranch(current: { eq: true }) {
name
}
}
```### Authors
```graphql
{
allGitAuthor(sort: { fields: name }) {
nodes {
name
}
totalCount
}
}
```