From 95b3439fab75f533ba239f198a318a536a865b79 Mon Sep 17 00:00:00 2001 From: Philip Ebels Date: Fri, 31 Aug 2018 18:41:57 +0200 Subject: [PATCH] Fixed version bug --- index.js | 2 ++ lib/xapi.js | 3 +-- package-lock.json | 19 +++++++------------ package.json | 3 +-- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/index.js b/index.js index aa0f9cbb76..8e0a87c113 100644 --- a/index.js +++ b/index.js @@ -11,12 +11,14 @@ const Xapi = require('./lib/xapi.js'); const cmdargs = require('./lib/util/cmd.helper.js'); const cluster = require('cluster'); const numCPUs = require('os').cpus().length; +const { version } = require('./package.json'); function startXmysql(sqlConfig) { /**************** START : setup express ****************/ let app = express(); + app.set('version', version); app.use(morgan('tiny')); app.use(cors()); app.use(bodyParser.json()); diff --git a/lib/xapi.js b/lib/xapi.js index d4ba75059f..c6b6d8fc47 100644 --- a/lib/xapi.js +++ b/lib/xapi.js @@ -4,7 +4,6 @@ var Xsql = require('./xsql.js'); var Xctrl = require('./xctrl.js'); var multer = require('multer'); const path = require('path'); -const pkginfo = require('pkginfo')(module); const v8 = require('v8'), os = require('os'); @@ -444,7 +443,7 @@ class Xapi { let version = {}; - version['Xmysql'] = pkginfo.version; + version['Xmysql'] = this.app.get('version'); version['mysql'] = await this.getMysqlHealth(); version['node'] = process.versions.node; res.json(version); diff --git a/package-lock.json b/package-lock.json index fa59563e0b..e0721dd658 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "xmysql", - "version": "0.4.8", + "version": "0.4.9", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -621,9 +621,9 @@ } }, "nan": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", - "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz", + "integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw==", "dev": true }, "negotiator": { @@ -674,11 +674,6 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, - "pkginfo": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz", - "integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8=" - }, "process-nextick-args": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", @@ -824,9 +819,9 @@ "dev": true }, "sleep": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/sleep/-/sleep-5.1.1.tgz", - "integrity": "sha1-h4+h1E0I7rDyb7IBjvhinrGjq5Q=", + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/sleep/-/sleep-5.2.3.tgz", + "integrity": "sha512-vC05N1XqgIiPIj6tEq7wt0R32aTycJv4Ymo/jwSEp2PkeU1GCJ1tkl+RdYZEo7Gjebq8QQuhFuEe7vsyVGlFRA==", "dev": true, "requires": { "nan": ">=2.5.1" diff --git a/package.json b/package.json index ec84182f23..234a90f7cd 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,7 @@ "express": "^4.16.1", "morgan": "^1.9.0", "multer": "^1.3.0", - "mysql": "^2.15.0", - "pkginfo": "^0.4.1" + "mysql": "^2.15.0" }, "devDependencies": { "mocha": "^5.2.0",