From bbaef7dfe102c3efd85ce8ec60200a1c9ce5bfcd Mon Sep 17 00:00:00 2001
From: David Sehnal <david.sehnal@gmail.com>
Date: Mon, 11 Feb 2019 12:23:52 +0100
Subject: [PATCH] mol-plugin: include build date to version

---
 package-lock.json         | Bin 529876 -> 530677 bytes
 package.json              |   1 +
 src/mol-plugin/context.ts |   4 ++--
 src/mol-plugin/layout.ts  |   7 +++++++
 src/mol-plugin/version.ts |   3 ++-
 webpack.config.js         |  10 +++++++++-
 6 files changed, 21 insertions(+), 4 deletions(-)
 create mode 100644 src/mol-plugin/layout.ts

diff --git a/package-lock.json b/package-lock.json
index cb657e43817f3b68b6fc4b57e3a02f027a15d01a..1da5d5be1c5d3772395d954677aef4f451a7ba62 100644
GIT binary patch
delta 736
zcmY+AUr1A77{)o@&N-iJxgGkaDcQ(!Mc9ryHOwMwY~Y{i&?uG4Ikz(RznUO6Hi>Cr
zxOLJOQOc+bA<We&PdAZwLXaELg%pud28oD4-Nnex*G1kv&+q#l-uHdpJ<|SqqD_4J
z0=E{J9YS(hC1!k0u(A`A%X35t>YuDA{`hPlzkI`Qgf>UE6w^`4*1sqVjz=g~lKLo-
z`p*wsr-~GEL`wBjQzwYL^O_oc2H{?00Pk(gKurbC8JR(9=&rz9Abb-UAvJ*x!1oHg
zABHNiT2h8l9tE*5DqEj}&Jpz?m&t}?1T_+SR*5s=<26bN>2Ycsa5IR5iD^_I50a97
zC{IOZo~glGL0hTNK&S?DaBmvv$iw3-)=VO6rPvI2Td)RhEGRgL?NZRdH?uk57(%~6
zA3}$rH-^SZOdm%s!e%3^2KXtYlUCxWiy|;&!7A{)r8O{X#k3R?P-X@R);(o8IMTYl
zcIq_6fp3sj!O9q#Be}%~^j;yA-YliZ(UMAL{pm?0r6&~wujG!!3BgNAnV0A#Bo{0C
zh8HPlv(Zfds)v?VJ<P~FX?*M``$<h?yp|m<ktNi>M|-66VfG<|0}h|dW_Q4S9laa0
zQTABDKT_!O+BzHoeWCvHl|ZNGLg7XZkr(VfA)%(5cuTOmsMctAnGB^>Cd<|42D`Di
zI@lHD-QDf_4r`;Qx}`37(Qghk9qj3G2Ylv|`f8K0jOYDMtJ89-qtxbi`pTUr-NkNe
zozqm_Q`-)4FSAo<n9qm$mvpg$KV*QaP9_)D23a~9WoM#z)Jd*Ntl&-D#;Zb#=l%@)
F_CGV|83O<S

delta 620
zcmY+BPe@cz6vnw{?z``m&7UBdH#VaWqJ$`k6rzN*2$%85O%x1+q6KO_qD7?CWXT}q
zSYF4^O<G&im^8QuM(zq1`oM&0VUjhF6-|&3RMfl?qITao=R3dez*&D}y?9_{bF0$5
zZ_3fPLWXjDN`IFX|21B&%@i8nB2(jE-`BuNix?JS;@QwW7Eyhb%s7peFf-M7H=AY~
zvg-yr;FA^)qdmvV)M|>!qj21Usc()AKStivqljOn^Kh$q6#m0{rP`aMJxtoa!sxq3
ziK1wUX=SMGrbe&Iyf%X9*+mhVy~Gh3qefW$6jmp%Q+bJJP-AH_7~C@~sy_D9!GiSQ
zv#rFvEI;b!cnDYS(B&dLu}yI78=$ku-=qqeSSmrjLDS{h_Y$}dsT99Y=m8}6lL^nN
z_DMRz-~`!rxUzs;9%cr9Eb;*6Dhi2j25DU{f<Jd@A;jalU)n#nA{qB6x9C{$T8!Q;
z1bPrvH$tUbU~e)evC=_@kiSjsuzEz*&@?r`PE!r?7rBLV<)TIgGXiyv9z!z2EN^%!
z)ign>X~H)-1G`z<IW-}h7-ARrW|?~KhqHqP)YCRTOMm~hi24BA4SPwih25fAa(<{A
zP74>QPKT>bN6XB^%4w#mtP{(D4H-Qy2CI?CY7w>2Mk781JB6+~dPD``i7AX!Rj*K0
dy?VM8D<5<d?k8QSS6_5r=$|Du;4_*_{{RSE?vwxk

diff --git a/package.json b/package.json
index b13905466..7f7083981 100644
--- a/package.json
+++ b/package.json
@@ -104,6 +104,7 @@
     "raw-loader": "^1.0.0",
     "resolve-url-loader": "^3.0.0",
     "sass-loader": "^7.1.0",
+    "string-replace-loader": "^2.1.1",
     "style-loader": "^0.23.1",
     "ts-jest": "^23.10.5",
     "tslint": "^5.12.1",
diff --git a/src/mol-plugin/context.ts b/src/mol-plugin/context.ts
index 17cd0f5ed..5f616a0fb 100644
--- a/src/mol-plugin/context.ts
+++ b/src/mol-plugin/context.ts
@@ -26,7 +26,7 @@ import { LociLabelEntry, LociLabelManager } from './util/loci-label-manager';
 import { ajaxGet } from 'mol-util/data-source';
 import { CustomPropertyRegistry } from './util/custom-prop-registry';
 import { VolumeRepresentationRegistry } from 'mol-repr/volume/registry';
-import { PLUGIN_VERSION } from './version';
+import { PLUGIN_VERSION, PLUGIN_VERSION_DATE } from './version';
 
 export class PluginContext {
     private disposed = false;
@@ -174,7 +174,7 @@ export class PluginContext {
         this.lociLabels = new LociLabelManager(this);
 
         // TODO: find a better solution for this.
-        setTimeout(() => this.log.message(`Mol* Plugin ${PLUGIN_VERSION}`), 500);
+        setTimeout(() => this.log.message(`Mol* Plugin ${PLUGIN_VERSION} [${PLUGIN_VERSION_DATE}]`), 500);
     }
 
     // settings = ;
diff --git a/src/mol-plugin/layout.ts b/src/mol-plugin/layout.ts
new file mode 100644
index 000000000..7c7fe8338
--- /dev/null
+++ b/src/mol-plugin/layout.ts
@@ -0,0 +1,7 @@
+/**
+ * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ */
+
+// TODO
\ No newline at end of file
diff --git a/src/mol-plugin/version.ts b/src/mol-plugin/version.ts
index 42890943f..26b3a278f 100644
--- a/src/mol-plugin/version.ts
+++ b/src/mol-plugin/version.ts
@@ -4,4 +4,5 @@
  * @author David Sehnal <david.sehnal@gmail.com>
  */
 
-export const PLUGIN_VERSION = '0.1.0';
\ No newline at end of file
+export const PLUGIN_VERSION = '0.5.0';
+export const PLUGIN_VERSION_DATE = '$PLUGIN_VERSION_DATE$';
\ No newline at end of file
diff --git a/webpack.config.js b/webpack.config.js
index 382ff11e2..50f0a8527 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -28,7 +28,15 @@ const sharedConfig = {
             {
                 test: /\.(s*)css$/,
                 use: [MiniCssExtractPlugin.loader, 'css-loader', 'resolve-url-loader', 'sass-loader']
-            }
+            },
+            {
+                test: /version\.js$/,
+                loader: 'string-replace-loader',
+                options: {
+                  search: '$PLUGIN_VERSION_DATE$',
+                  replace: function (date) { return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate() } (new Date()),
+                }
+              }
         ]
     },
     plugins: [
-- 
GitLab