From 4b948bd523ba5026ff046fbca42d76fbb7ddd791 Mon Sep 17 00:00:00 2001 From: Heiko Rothe Date: Sun, 26 Jan 2020 00:33:07 +0100 Subject: [PATCH] fix: Load application correctly even when launched via bin --- bin/room-assistant.js | 2 +- src/app.module.ts | 2 ++ src/integrations/home-assistant/device.ts | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/room-assistant.js b/bin/room-assistant.js index 26a29ea7..75b13031 100644 --- a/bin/room-assistant.js +++ b/bin/room-assistant.js @@ -1,2 +1,2 @@ #!/usr/bin/env node -require('../src/main'); +require('../dist/main'); diff --git a/src/app.module.ts b/src/app.module.ts index a4809243..3238f029 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -9,6 +9,8 @@ import _ from 'lodash'; import { NestEmitterModule } from 'nest-emitter'; import { EventEmitter } from 'events'; +// tslint:disable-next-line:no-var-requires +export const VERSION = require('../package.json').version; export const CONFIGURED_INTEGRATIONS = c .get('global.integrations') // lodash separates numbers in the case functions - we want them to stick together, hence we remove the dashes around numbers diff --git a/src/integrations/home-assistant/device.ts b/src/integrations/home-assistant/device.ts index bf570231..30be1c34 100644 --- a/src/integrations/home-assistant/device.ts +++ b/src/integrations/home-assistant/device.ts @@ -1,4 +1,4 @@ -import { version } from '../../../package.json'; +import { VERSION } from '../../app.module'; export class Device { constructor(identifiers: string | string[]) { @@ -10,5 +10,5 @@ export class Device { manufacturer: string; model: string; name: string; - swVersion: string = version; + swVersion: string = VERSION; }