@noxify/gridsome-source-git
Git source for Gridsome
Last updated 4 months ago by noxify .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @noxify/gridsome-source-git 
SYNC missed versions from official npm registry.

gridsome-source-git

Source plugin for fetching data from a GIT repository. This source is based on the @gridsome/source-filesystem and includes all functionality which is available in the @gridsome/source-filesystem.

This is a port from Gatsby: https://github.com/stevetweeddale/gatsby-source-git But extended to enable the clone of private git repositories.

Table of contents

Install

npm install --s @noxify/gridsome-source-git

How to use

module.exports = {
  plugins: [
    {
      use: '@noxify/gridsome-source-git',
      options: {
        remote: 'https://github.com/noxify/test.git',
        target: 'git-source/noxify-test/',
        typeName: 'GitPost',
        route: '/gitpost/:id'
      }
    }
  ]
}

Configuration

Name Type Description Default
remote String Url to the repository null
target String Defines the url to the remote git null
branch String Defines the branch which should be used. null
pattern Array Defines which files should be imported. Multiple patterns are allowed. ['**/*']
privateRepo Boolean Defines the path where the remote files should be saved. null
credentials Object Defines the credentials to fetch private repository {}
credentials.username String Username which should be used for the authentication null
credentials.token String Access Token which should be used for the authentication null
typeName String Defines the GraphQL type name GitNode
baseDir String Check @gridsome/source-filesystem docs null
route String Check @gridsome/source-filesystem docs null
pathPrefix String Check @gridsome/source-filesystem docs null
index String Check @gridsome/source-filesystem docs ['index']
refs String Check @gridsome/source-filesystem docs {}

Remote URL format

Please use always the following format for your remote url.

Provider Format
Github https://github.com/<username>/<reponame>.git
GitLab https://gitlab.com/<username>/<reponame>.git
BitBucket https://bitbucket.org/<username>/<reponame>.git

Routes

Since gridsome 0.7.7 you can define your routes via templates. Detailed introductions can be found here: (https://gridsome.org/docs/templates/)

Supported provider

We have tested the plugin with:

  • Github
  • GitLab
  • Bitbucket

Supported Repository types

The source plugin supports public and private repositories.

Access to private repositories

  1. Create a new personal access token
  2. Add privateRepo to your source definition and set it to true
  3. Add credentials.username and credentials.token to your source definition ( Please check also the Examples section )

How to generate a personal access token

Examples

Public repository

module.exports = {
  siteName: 'Gridsome',
  plugins: [
    {
      use: '~/plugins/gridsome-source-git',
      options: {
        name: 'public-github',
        remote: 'https://github.com/noxify/gridsome-source-git-public-test.git',
        target: 'git-source/github/public/',
        typeName: 'PublicGithub'
      }
    }
  ]
}

Private repository

module.exports = {
  siteName: 'Gridsome',
  plugins: [
    {
      use: '~/plugins/gridsome-source-git',
      options: {
        remote: 'https://github.com/noxify/gridsome-source-git-private-test.git',
        target: 'git-source/github/private/',
        privateRepo: true,
        credentials: {
          username: '<github username>',
          token: '<github personal access token>'
        },
        typeName: 'PrivateGithub'
      }
    }
  ]
}

Credits

Special thanks goes to

Current Tags

  • 2.0.0                                ...           latest (4 months ago)

6 Versions

  • 2.0.0                                ...           4 months ago
  • 1.1.1                                ...           8 months ago
  • 1.1.0                                ...           8 months ago
  • 1.0.2                                ...           9 months ago
  • 1.0.1                                ...           9 months ago
  • 1.0.0                                ...           9 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (8)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |