Skip to content

Commit

Permalink
fix: re-clone private repo for simplicity and reliability
Browse files Browse the repository at this point in the history
  • Loading branch information
3cp committed May 30, 2019
1 parent 54d67d3 commit 16b3824
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/skeleton-dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const tar = require('tar-fs');
const {info, warn} = require('./log');
const {folderExists} = require('./file-exists');
const run = require('./run');
const del = require('del');

function resolveRepo(supplier) {
const r = hostedGit.fromUrl(supplier);
Expand Down Expand Up @@ -83,16 +84,16 @@ async function useGitRepo(folder, {git, gitFolder, committish}) {
const target = path.join(folder, gitFolder);

if (folderExists(target)) {
info('Got existing ' + target);
info('Try git pull');
await run('git', ['pull'], target);
} else {
info(`Try git clone ${git} ${gitFolder}`);
await run('git', ['clone', git, gitFolder], folder);
await del(target, {force: true});
}

info(`Try git checkout ${committish || 'master'}`);
await run('git', ['checkout', committish || 'master'], target);
info(`reparing skeleton: git clone ${git} ${gitFolder}`);
await run('git', ['clone', git, gitFolder], folder);

if (committish && committish !== 'master') {
info(`reparing skeleton: git checkout ${committish}`);
await run('git', ['checkout', committish], target);
}

info(`skeleton is ready at ${target}\n`);
return target;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"ansi-colors": "^3.2.4",
"ava": "^1.4.1",
"cross-spawn": "^6.0.5",
"del": "^4.1.1",
"eslint": "^5.16.0",
"gunzip-maybe": "^1.4.1",
"hosted-git-info": "^2.7.1",
Expand Down

0 comments on commit 16b3824

Please sign in to comment.