From b210f63638dba8471365de0f1c556335f90e3518 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Thu, 17 Dec 2020 15:24:40 +0000 Subject: [PATCH] Add version console log --- src/main.ts | 2 ++ src/store/state.ts | 3 +++ vue.config.js | 16 ++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/src/main.ts b/src/main.ts index 4948e9e..931aadb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,6 +52,8 @@ if(splash) { }); } +console.info(`LiveAtlas version ${store.state.version}`); + const app = createApp(App).use(store); // app.config.performance = true; diff --git a/src/store/state.ts b/src/store/state.ts index 75dc6c0..7edd7ed 100644 --- a/src/store/state.ts +++ b/src/store/state.ts @@ -25,6 +25,7 @@ import { import {DynmapProjection} from "@/leaflet/projection/DynmapProjection"; export type State = { + version: string; configuration: DynmapServerConfig; messages: DynmapMessageConfig; components: DynmapComponentConfig; @@ -55,6 +56,8 @@ export type State = { } export const state: State = { + version: process.env.PACKAGE_VERSION || 'Unknown', + configuration: { version: '', allowChat: false, diff --git a/vue.config.js b/vue.config.js index 6e60f75..df8d4b5 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,3 +1,9 @@ +const + webpack = require('webpack'), + fs = require('fs'), + packageJson = fs.readFileSync('./package.json'), + version = JSON.parse(packageJson).version || 'Unknown'; + module.exports = { publicPath: '', assetsDir: 'live-atlas', @@ -11,6 +17,16 @@ module.exports = { } }, + configureWebpack: { + plugins: [ + new webpack.DefinePlugin({ + 'process.env': { + PACKAGE_VERSION: '"' + version + '"' + } + }) + ] + }, + chainWebpack: config => { config.plugin('html') .tap(args => {