From c2463a9f7aba61f798e9d32d2b8dc9342b67373a Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Thu, 4 Jun 2020 14:23:59 +0200
Subject: [PATCH] Add a new watch-full mode including babel/terser etc

watch should be faster now, watch-full is the same as a production build, but slow
---
 README.md        | 5 ++++-
 package.json     | 6 +++---
 rollup.config.js | 9 ++++-----
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md
index 30e17ca..8962286 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,10 @@ git submodule update --init
 npm install
 
 # constantly build dist/bundle.js and run a local web-server on port 8001 
-npm run watch-local
+npm run watch
+
+# same as watch, but with babel, terser, etc active -> very slow
+npm run watch-full
 
 # run tests
 npm test
diff --git a/package.json b/package.json
index b340456..184b04c 100644
--- a/package.json
+++ b/package.json
@@ -68,9 +68,9 @@
     "build-demo": "rollup -c --environment BUILD:demo",
     "build-test": "rollup -c --environment BUILD:test",
     "i18next": "i18next-scanner",
-    "watch": "npm run watch-local",
-    "watch-local": "rollup -c --watch",
-    "watch-dev": "rollup -c --watch --environment BUILD:development",
+    "watch": "rollup -c --watch",
+    "watch-local": "npm run watch",
+    "watch-full": "rollup -c --watch --environment WATCH_FULL",
     "test": "npm run build-test && karma start --singleRun",
     "lint": "eslint ."
   }
diff --git a/rollup.config.js b/rollup.config.js
index ad72506..db470c6 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -29,6 +29,7 @@ const USE_HTTPS = false;
 const pkg = require('./package.json');
 const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local';
 const watch = process.env.ROLLUP_WATCH === 'true';
+const watchFull = process.env.WATCH_FULL !== undefined;
 console.log("build: " + build);
 let basePath = '';
 let entryPointURL = '';
@@ -37,9 +38,9 @@ let keyCloakBaseURL = '';
 let keyCloakClientId = '';
 let pdfAsQualifiedlySigningServer = '';
 let matomoSiteId = 131;
-let useTerser = true;
-let useBabel = true;
-let checkLicenses = !watch;
+let useTerser = !watch || watchFull;
+let useBabel = !watch || watchFull;
+let checkLicenses = !watch || watchFull;
 
 switch (build) {
   case 'local':
@@ -49,7 +50,6 @@ switch (build) {
     keyCloakBaseURL = 'https://' + keyCloakServer + '/auth';
     keyCloakClientId = 'auth-dev-mw-frontend-local';
     pdfAsQualifiedlySigningServer = 'sig-dev.tugraz.at';
-    useTerser = false;
     break;
   case 'development':
     basePath = '/apps/signature/';
@@ -83,7 +83,6 @@ switch (build) {
     keyCloakBaseURL = '';
     keyCloakClientId = '';
     pdfAsQualifiedlySigningServer = '';
-    useTerser = false;
     break;
   default:
     console.error('Unknown build environment: ' + build);
-- 
GitLab