From: Jérôme Benoit Date: Mon, 3 Jul 2023 20:32:11 +0000 (+0200) Subject: refactor: cleanup package.json version usage X-Git-Tag: v1.2.18~83 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=628c30e510dd0f12be4432bd5eb0ff86790c4de0;p=e-mobility-charging-stations-simulator.git refactor: cleanup package.json version usage Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 6fe78d77..bed2692b 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -10,7 +10,7 @@ import chalk from 'chalk'; import { ChargingStationUtils } from './ChargingStationUtils'; import type { AbstractUIServer } from './ui-server/AbstractUIServer'; import { UIServerFactory } from './ui-server/UIServerFactory'; -import packageJson from '../../package.json' assert { type: 'json' }; +import { version } from '../../package.json' assert { type: 'json' }; import { BaseError } from '../exception'; import { type Storage, StorageFactory } from '../performance'; import { @@ -48,7 +48,7 @@ export class Bootstrap extends EventEmitter { private readonly uiServer!: AbstractUIServer | null; private readonly storage!: Storage; private numberOfStartedChargingStations!: number; - private readonly version: string = packageJson.version; + private readonly version: string = version; private initializedCounters: boolean; private started: boolean; private starting: boolean; diff --git a/src/worker/WorkerConstants.ts b/src/worker/WorkerConstants.ts index 99e29fcb..4e0bce1f 100644 --- a/src/worker/WorkerConstants.ts +++ b/src/worker/WorkerConstants.ts @@ -12,6 +12,8 @@ export class WorkerConstants { public static readonly DEFAULT_POOL_MAX_SIZE = availableParallelism(); public static readonly DEFAULT_ELEMENTS_PER_WORKER = 1; + public static readonly version = '1.0.0'; + private constructor() { // This is intentional } diff --git a/src/worker/WorkerSet.ts b/src/worker/WorkerSet.ts index b76af5df..270f57b1 100644 --- a/src/worker/WorkerSet.ts +++ b/src/worker/WorkerSet.ts @@ -42,6 +42,7 @@ export class WorkerSet extends WorkerAbstract { get info(): SetInfo { return { + version: WorkerConstants.version, type: 'set', worker: 'thread', size: this.size, diff --git a/src/worker/WorkerTypes.ts b/src/worker/WorkerTypes.ts index 7bcb108e..3986164b 100644 --- a/src/worker/WorkerTypes.ts +++ b/src/worker/WorkerTypes.ts @@ -9,6 +9,7 @@ export enum WorkerProcessType { } export type SetInfo = { + version: string; type: string; worker: string; size: number;