Browse Source

fix missing version in release version

pull/11/head
rozetko 2 years ago
parent
commit
bfcbc8cc8a
  1. 6
      build/webpack.base.conf.js
  2. 1
      src/globals.d.ts
  3. 4
      src/routes/connect.ts
  4. 2
      src/routes/status.ts

6
build/webpack.base.conf.js

@ -1,3 +1,4 @@
const webpack = require('webpack');
const path = require('path'); const path = require('path');
@ -21,6 +22,11 @@ module.exports = {
resolve: { resolve: {
extensions: [".ts", ".js"] extensions: [".ts", ".js"]
}, },
plugins: [
new webpack.DefinePlugin({
__VERSION__: JSON.stringify(require(resolve('./package.json')).version)
})
],
module: { module: {
rules: [ rules: [
{ {

1
src/globals.d.ts vendored

@ -0,0 +1 @@
declare const __VERSION__: string;

4
src/routes/connect.ts

@ -21,7 +21,7 @@ async function checkConnection(req, res) {
return; return;
} }
res.status(200).send({ version: process.env.npm_package_version }); res.status(200).send({ version: __VERSION__ });
} }
async function connectPlugin(req, res) { async function connectPlugin(req, res) {
@ -44,7 +44,7 @@ async function connectPlugin(req, res) {
console.log(`Grafana at ${grafanaUrl} is connected`); console.log(`Grafana at ${grafanaUrl} is connected`);
res.status(200).send({ version: process.env.npm_package_version }); res.status(200).send({ version: __VERSION__ });
} }
export const router = express.Router(); export const router = express.Router();

2
src/routes/status.ts

@ -2,7 +2,7 @@ import * as express from 'express'
async function getStatus(req, res) { async function getStatus(req, res) {
res.status(200).send({ version: process.env.npm_package_version }); res.status(200).send({ version: __VERSION__ });
} }
export const router = express.Router(); export const router = express.Router();

Loading…
Cancel
Save