Skip to content

Commit

Permalink
Get electronVersion from node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
KristjanESPERANTO committed Jan 3, 2024
1 parent 26bf874 commit 2e743b1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ const colors = require("colors/safe");
const Log = require("logger");
const si = require("systeminformation");

global.packages = require(`${__dirname}/../package-lock.json`).packages;
try {
global.electronVersion = require(`${__dirname}/../node_modules/electron/package.json`).version;
} catch (error) {
Log.error(`Can't find electron. Have you performed 'npm run install-mm'? ${error}`);
}

module.exports = {
colors: {
Expand All @@ -24,7 +28,7 @@ module.exports = {
let systemDataString = "The following lines provide information about your system and may be of interest when troubleshooting.";
systemDataString += `\n ### SYSTEM: manufacturer: ${staticData["system"]["manufacturer"]}; model: ${staticData["system"]["model"]}; raspberry: ${staticData["system"]["raspberry"]}; virtual: ${staticData["system"]["virtual"]}`;
systemDataString += `\n ### OS: platform: ${staticData["os"]["platform"]}; distro: ${staticData["os"]["distro"]}; release: ${staticData["os"]["release"]}`;
systemDataString += `\n ### VERSIONS: MagicMirror: ${global.version}; electron: ${global.packages["node_modules/electron"]["version"]}; kernel: ${staticData["versions"]["kernel"]}; node: ${staticData["versions"]["node"]}; npm: ${staticData["versions"]["npm"]}; pm2: ${staticData["versions"]["pm2"]}; docker: ${staticData["versions"]["docker"]}`;
systemDataString += `\n ### VERSIONS: MagicMirror: ${global.version}; electron: ${global.electronVersion}; kernel: ${staticData["versions"]["kernel"]}; node: ${staticData["versions"]["node"]}; npm: ${staticData["versions"]["npm"]}; pm2: ${staticData["versions"]["pm2"]}; docker: ${staticData["versions"]["docker"]}`;
if (typeof staticData["dockerInfo"] !== "undefined") systemDataString += `\n ### DOCKER: containers: ${staticData["dockerInfo"]["containers"]}; operatingSystem: ${staticData["dockerInfo"]["operatingSystem"]}; osType: ${staticData["versions"]["osType"]}; architecture: ${staticData["versions"]["architecture"]}; serverVersion: ${staticData["versions"]["serverVersion"]}`;
Log.info(systemDataString);
} catch (e) {
Expand Down

0 comments on commit 2e743b1

Please sign in to comment.