From 35ffdf5fa5472c8fd9e396d51fbbf7f32cbf75bd Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 12 Feb 2019 20:45:54 +0100 Subject: [PATCH] Better time output --- build/lib/task.js | 13 ++----------- build/lib/task.ts | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/build/lib/task.js b/build/lib/task.js index 1f688728dce..4555bbdd068 100644 --- a/build/lib/task.js +++ b/build/lib/task.js @@ -13,16 +13,7 @@ function _isPromise(p) { return false; } function _renderTime(time) { - if (time < 1000) { - return `${time.toFixed(2)} ms`; - } - let seconds = time / 1000; - if (seconds < 60) { - return `${seconds.toFixed(1)} s`; - } - let minutes = Math.floor(seconds / 60); - seconds -= minutes * 60; - return `${minutes} m and ${seconds} s`; + return `${Math.round(time)} ms`; } async function _execute(task) { const name = task.taskName || task.displayName || ``; @@ -34,7 +25,7 @@ async function _execute(task) { const elapsedArr = process.hrtime(startTime); const elapsedNanoseconds = (elapsedArr[0] * 1e9 + elapsedArr[1]); if (!task._tasks) { - fancyLog(`Finished`, ansiColors.cyan(name), 'after', ansiColors.green(_renderTime(elapsedNanoseconds / 1e6))); + fancyLog(`Finished`, ansiColors.cyan(name), 'after', ansiColors.magenta(_renderTime(elapsedNanoseconds / 1e6))); } } async function _doExecute(task) { diff --git a/build/lib/task.ts b/build/lib/task.ts index b6c4f218406..b1a0c903f80 100644 --- a/build/lib/task.ts +++ b/build/lib/task.ts @@ -33,16 +33,7 @@ function _isPromise(p: Promise | NodeJS.ReadWriteStream): p is Promise { @@ -55,7 +46,7 @@ async function _execute(task: Task): Promise { const elapsedArr = process.hrtime(startTime); const elapsedNanoseconds = (elapsedArr[0] * 1e9 + elapsedArr[1]); if (!task._tasks) { - fancyLog(`Finished`, ansiColors.cyan(name), 'after', ansiColors.green(_renderTime(elapsedNanoseconds / 1e6))); + fancyLog(`Finished`, ansiColors.cyan(name), 'after', ansiColors.magenta(_renderTime(elapsedNanoseconds / 1e6))); } }