From f9a3fe962b560026992db9c555c9c638780a1d62 Mon Sep 17 00:00:00 2001 From: Francois Gerthoffert Date: Fri, 31 Jan 2020 14:03:38 -0500 Subject: [PATCH] Slight changes in manifest handling --- src/commands/manifest/create.ts | 2 +- src/commands/manifest/run.ts | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/commands/manifest/create.ts b/src/commands/manifest/create.ts index 15e04e3..5c3fcb3 100644 --- a/src/commands/manifest/create.ts +++ b/src/commands/manifest/create.ts @@ -89,7 +89,7 @@ export default class ManifestCreate extends Command { }, { type: 'shell', - command: 'node -v' + cmd: 'node -v' } ], // List source docker images that would be used in the absence of corresponding images diff --git a/src/commands/manifest/run.ts b/src/commands/manifest/run.ts index 14b2183..5f812ed 100644 --- a/src/commands/manifest/run.ts +++ b/src/commands/manifest/run.ts @@ -1,4 +1,6 @@ import { flags } from '@oclif/command'; +import cli from 'cli-ux'; + import { performance } from 'perf_hooks'; import * as loadYamlFile from 'load-yaml-file'; import * as fs from 'fs'; @@ -52,10 +54,11 @@ export default class ManifestRun extends Command { if (manifestContent.jobs !== undefined && manifestContent.jobs.length > 0) { const gClient = await graphqlClient(flags); await waitAlive(gClient, 500000); // Wait for 500s by default - let browser = null; let jahiaPage = null; for (const job of manifestContent.jobs) { + cli.action.start('Starting a job of type: ' + job.type); + const t1 = performance.now(); if ([ 'webproject', 'groovy' ].includes(job.type)) { if (browser === null) { // eslint-disable-next-line no-await-in-loop @@ -119,10 +122,15 @@ export default class ManifestRun extends Command { console.log('ERROR: Unsupported job type'); exit(); } + cli.action.stop(' done (' + Math.round(performance.now() - t1) + ' ms)'); } - await jahiaPage.close(); - await closePuppeteer(browser); + if (jahiaPage !== null) { + await jahiaPage.close(); + } + if (browser !== null) { + await closePuppeteer(browser); + } } else { console.log('Manifest is empty and does not contain any jobs'); }