From: Jérôme Benoit Date: Thu, 25 May 2023 15:56:59 +0000 (+0200) Subject: fix: fix chalk invocation in configuration file handling code X-Git-Tag: v1.2.14~11 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=c5e52a07fb5e8e570355415762fc0d97ab4016e0;p=e-mobility-charging-stations-simulator.git fix: fix chalk invocation in configuration file handling code Extracted from PR #574 Signed-off-by: Jérôme Benoit --- diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index e4215f94..6f53ef3b 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -55,7 +55,9 @@ export class Configuration { public static getUIServer(): UIServerConfiguration { if (Utils.hasOwnProp(Configuration.getConfig(), 'uiWebSocketServer')) { console.error( - chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration section 'uiWebSocketServer' usage. Use 'uiServer' instead}` + `${chalk.green(Configuration.logPrefix())} ${chalk.red( + "Deprecated configuration section 'uiWebSocketServer' usage. Use 'uiServer' instead" + )}` ); } let uiServerConfiguration: UIServerConfiguration = { @@ -137,9 +139,9 @@ export class Configuration { (stationTemplateUrl: StationTemplateUrl) => { if (!Utils.isUndefined(stationTemplateUrl['numberOfStation'])) { console.error( - chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key 'numberOfStation' usage for template file '${ - stationTemplateUrl.file - }' in 'stationTemplateUrls'. Use 'numberOfStations' instead}` + `${chalk.green(Configuration.logPrefix())} ${chalk.red( + `Deprecated configuration key 'numberOfStation' usage for template file '${stationTemplateUrl.file}' in 'stationTemplateUrls'. Use 'numberOfStations' instead` + )}` ); } } @@ -337,15 +339,19 @@ export class Configuration { !Utils.isUndefined((Configuration.getConfig()[sectionName] as Record)[key]) ) { console.error( - chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage in section '${sectionName}'${ - logMsgToAppend.trim().length > 0 ? `. ${logMsgToAppend}` : '' - }}` + `${chalk.green(Configuration.logPrefix())} ${chalk.red( + `Deprecated configuration key '${key}' usage in section '${sectionName}'${ + logMsgToAppend.trim().length > 0 ? `. ${logMsgToAppend}` : '' + }` + )}` ); } else if (!Utils.isUndefined(Configuration.getConfig()[key])) { console.error( - chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage${ - logMsgToAppend.trim().length > 0 ? `. ${logMsgToAppend}` : '' - }}` + `${chalk.green(Configuration.logPrefix())} ${chalk.red( + `Deprecated configuration key '${key}' usage${ + logMsgToAppend.trim().length > 0 ? `. ${logMsgToAppend}` : '' + }` + )}` ); } }