Browse Source

changes or something

master
peter 2 years ago
parent
commit
611de3e431

+ 8
- 2
angular.json View File

@@ -15,13 +15,15 @@
15 15
       "prefix": "app",
16 16
       "architect": {
17 17
         "build": {
18
-          "builder": "@angular-devkit/build-angular:browser",
18
+          "builder": "@angular-builders/custom-webpack:browser",
19 19
           "options": {
20
+            
20 21
             "outputPath": "dist",
21 22
             "index": "src/index.html",
22 23
             "main": "src/main.ts",
23 24
             "polyfills": "src/polyfills.ts",
24 25
             "tsConfig": "tsconfig.app.json",
26
+            
25 27
             "aot": false,
26 28
             "assets": [
27 29
               "src/favicon.ico",
@@ -40,6 +42,9 @@
40 42
           },
41 43
           "configurations": {
42 44
             "production": {
45
+              
46
+              "customWebpackConfig": {"path": "./custom-webpack.config.js"},
47
+              "tsConfig": "tsconfig.prod.json",
43 48
               "fileReplacements": [
44 49
                 {
45 50
                   "replace": "src/environments/environment.ts",
@@ -66,12 +71,13 @@
66 71
           }
67 72
         },
68 73
         "serve": {
69
-          "builder": "@angular-devkit/build-angular:dev-server",
74
+          "builder": "@angular-builders/custom-webpack:dev-server",
70 75
           "options": {
71 76
             "browserTarget": "dashboard:build"
72 77
           },
73 78
           "configurations": {
74 79
             "production": {
80
+              "customWebpackConfig": {"path": "./custom-webpack.config.js"},
75 81
               "browserTarget": "dashboard:build:production"
76 82
             }
77 83
           }

+ 13
- 0
custom-webpack.config.js View File

@@ -0,0 +1,13 @@
1
+const TerserPlugin = require('terser-webpack-plugin');
2
+module.exports = {
3
+    optimization: {
4
+        minimizer: [new TerserPlugin({
5
+          cache: true,
6
+          parallel: true,
7
+          terserOptions:{
8
+            mangle: true,
9
+            keep_classnames: false        
10
+          }
11
+        })],
12
+    }
13
+}

+ 16
- 0
package-lock.json View File

@@ -4,6 +4,22 @@
4 4
   "lockfileVersion": 1,
5 5
   "requires": true,
6 6
   "dependencies": {
7
+    "@angular-builders/custom-webpack": {
8
+      "version": "8.2.0",
9
+      "resolved": "https://registry.npmjs.org/@angular-builders/custom-webpack/-/custom-webpack-8.2.0.tgz",
10
+      "integrity": "sha512-6654RfyqhTGhCI0edC9YU/iMn1UJnzX01bxYJbDWFgvReCqXdlgy+Fe9tp1MeqKweX6BQ1d0gRroR/WjY1aX0A==",
11
+      "dev": true,
12
+      "requires": {
13
+        "lodash": "^4.17.10",
14
+        "webpack-merge": "^4.2.1"
15
+      }
16
+    },
17
+    "@angular-builders/dev-server": {
18
+      "version": "7.3.1",
19
+      "resolved": "https://registry.npmjs.org/@angular-builders/dev-server/-/dev-server-7.3.1.tgz",
20
+      "integrity": "sha512-rFr0NyFcwTb4RkkboYQN5JeR9ZraOkfUrQYljMSe/O01MM3SJvE8LYJbsyMwGtp71Rc8T6JrpdxaNEeYCV/4PA==",
21
+      "dev": true
22
+    },
7 23
     "@angular-devkit/architect": {
8 24
       "version": "0.802.2",
9 25
       "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.802.2.tgz",

+ 4
- 3
package.json View File

@@ -2,14 +2,13 @@
2 2
   "name": "dashboard",
3 3
   "version": "0.0.0",
4 4
   "scripts": {
5
-    "ng": "ng",
6 5
     "start": "npm run copy-dev-gui; ng serve --aot=false --optimization=false --proxy-config proxy.conf.json ",
6
+    "dev": "npm run copy-dev-gui; ng serve --aot=false --optimization=false --proxy-config proxy.conf.json --configuration=development",
7 7
     "build": "rm -f src/assets/*.js; ng build --prod --aot=false --optimization=false --build-optimizer=false",
8 8
     "copy-dev-gui": "cp src/app/apiclient/dist/FrontendPlugin.js src/assets/apiclient.js; cp src/app/wallet/dist/FrontendPlugin.js src/assets/wallet.js; cp src/app/pluginmanager/dist/FrontendPlugin.js src/assets/pluginmanager.js;",
9 9
     "test": "ng test",
10 10
     "lint": "ng lint",
11 11
     "e2e": "ng e2e",
12
-    "get-submodules": "git submodule init && git submodule update",
13 12
     "update-frontblock": "rm -rf node_modules/frontblock*; npm install"
14 13
   },
15 14
   "private": true,
@@ -40,7 +39,9 @@
40 39
     "zone.js": "~0.10.1"
41 40
   },
42 41
   "devDependencies": {
43
-    "@angular-devkit/build-angular": "~0.802.1",
42
+    "@angular-builders/custom-webpack": "^8.2.0",
43
+    "@angular-builders/dev-server": "^7.3.1",
44
+    "@angular-devkit/build-angular": "^0.802.2",
44 45
     "@angular/cli": "^8.2.2",
45 46
     "@angular/compiler-cli": "~8.2.1",
46 47
     "@angular/language-service": "~8.2.1",

+ 1
- 2
src/app/app-routing.module.ts View File

@@ -1,8 +1,7 @@
1 1
 import { NgModule } from '@angular/core';
2
-import { Routes, RouterModule, Route } from '@angular/router';
2
+import { Routes, RouterModule } from '@angular/router';
3 3
 import { HomeComponent } from './home/home.component';
4 4
 import { ErrorDisplayComponent } from './error-display/error-display.component';
5
-import { environment } from 'src/environments/environment';
6 5
 
7 6
 const routes: Routes = [{
8 7
   path: "",

+ 9
- 4
src/app/dynamic-loader/dynamic-loader.component.ts View File

@@ -52,7 +52,7 @@ import { environment } from "../../environments/environment"
52 52
 
53 53
 const fb = environment.production ? window["fb"] : {
54 54
   PluginManager: {
55
-    getLoadedPluginNames: () => [/*"ApiClient", "PluginManager",*/ "Wallet"]
55
+    getLoadedPluginNames: () => ["ApiClient", "PluginManager", "Wallet"]
56 56
   }
57 57
 }
58 58
 
@@ -86,9 +86,14 @@ export class DynamicLoaderComponent implements AfterViewInit {
86 86
     let module: FrontendPlugin
87 87
     if (!angularCore.isDevMode())
88 88
       module = await SystemJS.import("plugins/" + pluginName + ".js");
89
-    else 
90
-      module = await SystemJS.import("assets/" + pluginName.toLowerCase() + ".js")
91
-    
89
+    else
90
+      if(environment.loadLocal){
91
+        console.log("Loading "+pluginName+" from angular tsc-out")
92
+        module = await import("../" + pluginName.toLowerCase() + "/src/frontend/module")
93
+      }else{
94
+        console.log("Loading "+pluginName+" from fake backend")
95
+        module = await SystemJS.import("assets/" + pluginName.toLowerCase() + ".js")
96
+      }
92 97
 
93 98
 
94 99
     const plugin = new module['PluginModule']()

+ 1
- 1
src/app/pluginmanager

@@ -1 +1 @@
1
-Subproject commit ca427ed2e67c86a2b58a96730e719342c20f1adc
1
+Subproject commit 9d11085fd10533d5b9770435e659269bc6483532

+ 2
- 1
src/environments/environment.prod.ts View File

@@ -1,3 +1,4 @@
1 1
 export const environment = {
2
-  production: true
2
+  production: true,
3
+  loadLocal: false //no effect in production mode
3 4
 };

+ 0
- 3
tsconfig.app.json View File

@@ -11,10 +11,7 @@
11 11
     "node_modules",
12 12
     "src/test.ts",
13 13
     "src/**/*.spec.ts",
14
-    "src/app/**/*/backend/**/*",
15
-    "src/app/**/*/frontend/**/*",
16 14
     "src/app/**/*/node_modules/**/*",
17 15
     "src/app/**/*/dist/**/*"
18
-
19 16
   ]
20 17
 }

+ 16
- 0
tsconfig.prod.json View File

@@ -0,0 +1,16 @@
1
+{
2
+    "extends": "./tsconfig.app.json",
3
+    "include": [
4
+      "src/**/*.ts"
5
+    ],
6
+    "exclude": [
7
+      "node_modules",
8
+      "src/test.ts",
9
+      "src/**/*.spec.ts",
10
+      "src/app/**/*/node_modules/**/*",
11
+      "src/app/**/*/dist/**/*",
12
+      "src/app/**/*/backend/**/*",
13
+      "src/app/**/*/frontend/**/*",
14
+    ]
15
+  }
16
+  

Loading…
Cancel
Save