Skip to content
This repository was archived by the owner on Aug 9, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"html-minifier": "^3.5.15",
"markdown-to-jsx": "^6.6.2",
"minimist": "^1.2.0",
"nodegit": "^0.22.0",
"progress": "^2.0.0",
"prop-types": "^15.6.1",
"react": "^16.3.2",
Expand All @@ -75,6 +74,7 @@
"react-interface": "^0.9.8",
"react-router-dom": "^4.2.2",
"react-syntax-highlighter": "^7.0.4",
"simple-git": "^1.92.0",
"tmp": "^0.0.33",
"webpack": "^4.8.1",
"webpack-dev-middleware": "^3.1.3",
Expand Down
17 changes: 8 additions & 9 deletions src/core/externals.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs-extra')
const path = require('path')
const git = require('nodegit')
const git = require('simple-git/promise')
const { log, warn, error } = require('../utils/emit')

// Warnings for missing source information
Expand All @@ -17,12 +17,6 @@ const defaults = {
root: 'docs/'
}

function checkoutBranch (repo, source) {
return repo
.getBranch(`refs/remotes/origin/${source.branch}`)
.then(b => repo.checkoutRef(b))
}

function cloneExternals (dir, sources) {
// Ensure the tmp directory is cleared out
fs.emptyDirSync(dir)
Expand All @@ -39,9 +33,14 @@ function cloneExternals (dir, sources) {
// Override defaults with source config
const source = { ...defaults, ...s }

// Target directory for the cloned repo
const target = `${dir}/${source.name}`

// Clone the source folder to our tmp directory
const repo = await git.Clone(source.url, `${dir}/${source.name}`)
return checkoutBranch(repo, source)
await git().clone(source.url, target)

// Ensure the proper branch is checked out
return git(target).checkout(source.branch)
})

// Wait for all cloning to finish
Expand Down
Loading