Commit 30d05705 authored by Stefan Galinski's avatar Stefan Galinski 🎮
Browse files

[TASK] Update usage of hirestime

parent 60d9e313
const hirestime = require('hirestime');
const getElapsed = hirestime();
const getElapsed = hirestime.default();
const cliArguments = require('yargs').argv;
const logger = require('./logger');
const chalk = require('chalk');
......@@ -43,7 +43,7 @@ class Run {
}
static processEnd() {
logger.info(`SGC finished after ${getElapsed(hirestime.S)}s`, true);
logger.info(`SGC finished after ${getElapsed.s()}s`, true);
}
}
......
......@@ -32,7 +32,7 @@ module.exports = class Css extends Task {
async run(_subTask = null) {
return new Promise(async resolve => {
const steps = [];
this.getElapsed = hirestime();
this.getElapsed = hirestime.default();
if (_subTask) {
if (_subTask === 'qa') {
steps.push(this._runQa());
......@@ -52,7 +52,7 @@ module.exports = class Css extends Task {
steps.push(this._runCompile());
}
await Promise.all(steps);
this._logger.info(`Task ${chalk.bold('css')} finished after ${this.getElapsed(hirestime.S)}s`);
this._logger.info(`Task ${chalk.bold('css')} finished after ${this.getElapsed.s()}s`);
resolve();
});
}
......
......@@ -28,7 +28,7 @@ module.exports = class Images extends Task {
this._touchedFiles = 0;
this._failedFiles = [];
return new Promise(async resolve => {
this.getElapsed = hirestime();
this.getElapsed = hirestime.default();
if (_subTask === 'uploaded') {
await this._optimizeUploadedImages();
} else {
......@@ -63,7 +63,7 @@ module.exports = class Images extends Task {
let messageConfig = this._config.logMessages['images:uploadedSuccess'];
this._logger[messageConfig.level](messageConfig.message);
}
this._logger.info(`Task ${chalk.bold('images')} finished after ${this.getElapsed(hirestime.S)}s`);
this._logger.info(`Task ${chalk.bold('images')} finished after ${this.getElapsed.s()}s`);
resolve();
});
}
......@@ -87,7 +87,7 @@ module.exports = class Images extends Task {
let messageConfig = this._config.logMessages.imagesSuccess;
this._logger[messageConfig.level](messageConfig.message);
}
this._logger.info(`Task ${chalk.bold('images')} finished after ${this.getElapsed(hirestime.S)}s`);
this._logger.info(`Task ${chalk.bold('images')} finished after ${this.getElapsed.s()}s`);
resolve();
});
}
......
......@@ -26,7 +26,7 @@ module.exports = class Js extends Task {
*/
async run(_subTask = null) {
return new Promise(async resolve => {
this.getElapsed = hirestime();
this.getElapsed = hirestime.default();
const steps = [];
if (_subTask) {
// if _subTask is set, just execute that one task
......@@ -45,7 +45,7 @@ module.exports = class Js extends Task {
steps.push(this._runCompile());
}
await Promise.all(steps);
this._logger.info(`Task ${chalk.bold('js')} finished after ${this.getElapsed(hirestime.S)}s`);
this._logger.info(`Task ${chalk.bold('js')} finished after ${this.getElapsed.s()}s`);
resolve();
});
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment