From 6f8364b1dd7bdf72537780c6d5eb4c7a03215f42 Mon Sep 17 00:00:00 2001 From: MiniDigger Date: Wed, 6 Nov 2019 17:16:40 +0100 Subject: [PATCH] Print package versions on startup --- src/plugins/packages/index.js | 4 +++- .../packages/node_modules/thelounge-package-foo/package.json | 1 + test/plugins/packages/indexTest.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/packages/index.js b/src/plugins/packages/index.js index 5a238b85..d0381782 100644 --- a/src/plugins/packages/index.js +++ b/src/plugins/packages/index.js @@ -97,8 +97,10 @@ function loadPackages() { return; } + const version = packageInfo.version; packageInfo = packageInfo.thelounge; packageInfo.packageName = packageName; + packageInfo.version = version; packageMap.set(packageName, packageFile); @@ -116,7 +118,7 @@ function loadPackages() { packageFile.onServerStart(packageApis(packageInfo)); } - log.info(`Package ${colors.bold(packageName)} loaded`); + log.info(`Package ${colors.bold(packageName)} ${colors.green("v" + version)} loaded`); }); if (anyPlugins) { diff --git a/test/fixtures/.thelounge/packages/node_modules/thelounge-package-foo/package.json b/test/fixtures/.thelounge/packages/node_modules/thelounge-package-foo/package.json index 455dc352..0f286bc4 100644 --- a/test/fixtures/.thelounge/packages/node_modules/thelounge-package-foo/package.json +++ b/test/fixtures/.thelounge/packages/node_modules/thelounge-package-foo/package.json @@ -2,6 +2,7 @@ "name": "thelounge-package-foo", "private": true, "main": "index.js", + "version": "dummy", "thelounge": { "type": "package" }, diff --git a/test/plugins/packages/indexTest.js b/test/plugins/packages/indexTest.js index 5f9e50eb..4e149a9c 100644 --- a/test/plugins/packages/indexTest.js +++ b/test/plugins/packages/indexTest.js @@ -53,7 +53,7 @@ describe("packages", function() { packages.loadPackages(); expect(stdout).to.deep.equal( - "Package thelounge-package-foo loaded\nThere are packages using the experimental plugin API. Be aware that this API is not yet stable and may change in future The Lounge releases.\n" + "Package thelounge-package-foo vdummy loaded\nThere are packages using the experimental plugin API. Be aware that this API is not yet stable and may change in future The Lounge releases.\n" ); }); });