From 0e34d976c05884dc659d0da2f3956304db185c02 Mon Sep 17 00:00:00 2001
From: Alexander Rose <alexander.rose@weirdbyte.de>
Date: Fri, 3 Apr 2020 17:50:50 -0700
Subject: [PATCH] use version from package.json for plugin

---
 src/mol-plugin/version.ts | 9 ++++++---
 webpack.config.common.js  | 3 ++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/mol-plugin/version.ts b/src/mol-plugin/version.ts
index 68e9c4b0d..a91782d7a 100644
--- a/src/mol-plugin/version.ts
+++ b/src/mol-plugin/version.ts
@@ -5,8 +5,11 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-export const PLUGIN_VERSION = '0.6.0';
+/** version from package.json, to be filled in at bundle build time */
+declare const __VERSION__: string
+export const PLUGIN_VERSION = __VERSION__;
+
 /** unix time stamp, to be filled in at bundle build time */
-declare const __PLUGIN_VERSION_TIMESTAMP__: number
-export const PLUGIN_VERSION_TIMESTAMP = __PLUGIN_VERSION_TIMESTAMP__;
+declare const __VERSION_TIMESTAMP__: number
+export const PLUGIN_VERSION_TIMESTAMP = __VERSION_TIMESTAMP__;
 export const PLUGIN_VERSION_DATE = new Date(PLUGIN_VERSION_TIMESTAMP);
\ No newline at end of file
diff --git a/webpack.config.common.js b/webpack.config.common.js
index 386a5a8d8..685b48184 100644
--- a/webpack.config.common.js
+++ b/webpack.config.common.js
@@ -36,7 +36,8 @@ const sharedConfig = {
             ],
         }),
         new webpack.DefinePlugin({
-            __PLUGIN_VERSION_TIMESTAMP__: webpack.DefinePlugin.runtimeValue(() => `${new Date().valueOf()}`, true),
+            __VERSION__: JSON.stringify(require('./package.json').version),
+            __VERSION_TIMESTAMP__: webpack.DefinePlugin.runtimeValue(() => `${new Date().valueOf()}`, true),
             'process.env.DEBUG': JSON.stringify(process.env.DEBUG)
         }),
         new MiniCssExtractPlugin({ filename: 'app.css' })
-- 
GitLab