From f393f300e565a50fc20fca8c9cf2ac2abe14e978 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 1 Dec 2020 20:04:36 +0100 Subject: [PATCH] chore: refactiring the on progress callback so we can see more ata and failures --- .../src/scaffolder/stages/prepare/github.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/prepare/github.ts b/plugins/scaffolder-backend/src/scaffolder/stages/prepare/github.ts index 1eef5397de..ff814c20ba 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/prepare/github.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/prepare/github.ts @@ -67,22 +67,22 @@ export class GithubPreparer implements PreparerBase { dir: checkoutLocation, singleBranch: true, depth: 1, + onProgress: event => { + const total = event.total + ? `${event.loaded / event.total}%` + : event.loaded; + opts.logger.info({ status: event.phase, total }); + }, + headers: { + 'user-agent': 'git/@isomorphic-git', + }, onAuth: () => ({ username: token, password: 'x-oauth-basic' }), }); } catch (ex) { opts.logger.error( - `Failed checking out repository:${repositoryCheckoutUrl}`, + `Failed checking out repository: ${repositoryCheckoutUrl}`, ); opts.logger.error(ex.message); - console.warn(ex.data.url); - console.warn({ - fs: require('fs'), - http, - url: repositoryCheckoutUrl, - dir: templateDirectory, - depth: 1, - onAuth: () => ({ username: token, password: 'x-oauth-basic' }), - }); throw ex; }