0.1.0 • Published 4 years ago

gatsby-plugin-git-clone v0.1.0

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

gatsby-plugin-git-clone

Version License Travis CI

A simple plugin for Gatsby that clones a remote Git repository before building. This will run git clone when you start Gatsby, with develop or build. If the repository already exists locally, it will update the repository to the latest commit.

This plugin can be used in combination with gatsby-source-filesystem to fetch content from a different repository, for example.

Requirements

  • Node.js v10 or newer.
  • Git.

Installation

First, install the package using npm or yarn.

yarn add -D gatsby-plugin-git-clone

or

npm install --save-dev gatsby-plugin-git-clone

Getting started

To use the plugin, add it to your gatsby-config.js:

import { resolve } from 'path';

export default {
  // ...
  plugins: [
    {
      resolve: 'gatsby-plugin-git-clone',
      options: {
        repository: 'https://github.com/foo/bar.git',
        path: resolve(__dirname, './foo')
      }
    }
  ]
}

Options

gatsby-plugin-git-clone has a few options:

  • repository (required) - The remote repository to clone.
  • path (required) - The local path to clone the repository to.
  • branch (optional) - The branch to clone.
  • gitOptions (optional) - The options to pass to simple-git. See the simple-git documentation.