Browse Source

Initial working version

master
nitowa 1 year ago
commit
3175b262c2

+ 11
- 0
.gitignore View File

@@ -0,0 +1,11 @@
1
+build/*
2
+!build/.gítkeep
3
+gateway/*
4
+!gateway/index.html
5
+gui/*
6
+!gui/.gitkeep
7
+lib
8
+node_modules
9
+src/frontend/build
10
+src/frontend/dist
11
+src/frontend/.angular

+ 14
- 0
gateway/index.html View File

@@ -0,0 +1,14 @@
1
+<!doctype html>
2
+<html lang="en">
3
+<head>
4
+  <script src="https://bundle.run/browserify-zlib@0.2.0"></script>
5
+  <script src="https://bundle.run/buffer@6.0.3"></script>
6
+  <script src="https://cdn.jsdelivr.net/npm/ripple-lib@1.10.0/build/ripple-latest-min.min.js"></script>
7
+  <script src="https://cdn.jsdelivr.net/npm/xrpl@2.1.1"></script>
8
+</head>
9
+<body>
10
+  Loading ...
11
+</body>
12
+<script src="main.js"></script>
13
+
14
+</html>

+ 0
- 0
gui/.gitkeep View File


+ 6884
- 0
package-lock.json
File diff suppressed because it is too large
View File


+ 42
- 0
package.json View File

@@ -0,0 +1,42 @@
1
+{
2
+  "name": "rjsvm",
3
+  "version": "1.0.0",
4
+  "description": "",
5
+  "main": "lib/Launcher.js",
6
+  "scripts": {
7
+    "clean": "rm -rf gui/* gateway/main.js lib",
8
+    "start": "npm run build && npm run deploy",
9
+    "tsc": "tsc",
10
+    "build": "npm run clean && npm run build-scripts && npm run build-gui && npm run copy-gui",
11
+    "build-scripts": "tsc",
12
+    "build-gui": "cd src/frontend && npm run build",
13
+    "copy-gui": "cp src/frontend/build/index.html gui",
14
+    "webpack-gateway": "webpack --config webpack.gateway.js --progress && cp build/gateway/main.js gateway",
15
+    "deploy": "node ./lib/Deploy.js"
16
+  },
17
+  "author": "",
18
+  "license": "ISC",
19
+  "dependencies": {
20
+    "chai": "^4.3.4",
21
+    "node-fetch": "^2.6.1",
22
+    "xrpio": "^0.1.6",
23
+    "buffer": "^6.0.3",
24
+    "xrpl": "^2.6.0-beta.0"
25
+  },
26
+  "devDependencies": {
27
+    "@types/node": "^18.11.9",
28
+    "base-64": "^1.0.0",
29
+    "browserify-zlib": "^0.2.0",
30
+    "buffer": "^6.0.3",
31
+    "crypto-browserify": "^3.12.0",
32
+    "mocha": "^8.3.2",
33
+    "process": "^0.11.10",
34
+    "ts-loader": "^8.1.0",
35
+    "typescript": "^4.9.3",
36
+    "url": "^0.11.0",
37
+    "utf8": "^3.0.0",
38
+    "webpack": "^5.75.0",
39
+    "webpack-bundle-analyzer": "^4.7.0",
40
+    "webpack-cli": "^5.0.0"
41
+  }
42
+}

+ 5
- 0
src/Browser.ts View File

@@ -0,0 +1,5 @@
1
+(window as any).global = window;
2
+(window as any).Buffer = (window as any).buffer.Buffer;
3
+const rippleApi = require('xrpio')
4
+window['xrpIO'] = rippleApi.xrpIO
5
+

+ 8
- 0
src/Configuration.ts View File

@@ -0,0 +1,8 @@
1
+
2
+export const config = {
3
+  "oracle": true,
4
+  "secret": "sEdTP9Wkb4FSeaFhBavaob336sUTnqy",
5
+  "treasuryAddress": "rffH6RPq8xcKAWVvdYsiGEFrz1mz2iH3oj",
6
+  "contractAddress": "rDXi28Ud76cz9LtR2vAwsmGfqMcnfCTm8g", //pk: sEdSMv9Ztd2njbAhL3tTYqVRTKMQEME
7
+  "rippleNode": "wss://s.altnet.rippletest.net:51233",
8
+}

+ 20
- 0
src/Deploy.ts View File

@@ -0,0 +1,20 @@
1
+import fs from 'fs/promises';
2
+import { config } from './Configuration';
3
+import { xrpIO } from 'xrpio'
4
+const child_process = require('child_process');
5
+const path = require('path');
6
+
7
+(async () => {
8
+    const api = new xrpIO(config.rippleNode)
9
+    await api.connect()
10
+    const htmlPath = path.join(__dirname, "..", "gui", "index.html")
11
+    console.log("Getting html from "+htmlPath)
12
+    const htmlBuf = await fs.readFile(htmlPath)
13
+    const html = htmlBuf.toString('ascii')
14
+    const dataHash = await api.treeWrite(html, config.contractAddress, config.secret)
15
+    await api.disconnect()
16
+    console.log("Done. Your upload is at: ", dataHash);
17
+    console.log("Building gateway ...")
18
+
19
+    child_process.exec(`DATA_HASH=${dataHash} npm run webpack-gateway`, console.log)
20
+})()

+ 13
- 0
src/Gateway.ts View File

@@ -0,0 +1,13 @@
1
+(window as any).global = window;
2
+(window as any).Buffer = (window as any).Buffer || require('buffer/').Buffer;
3
+(window as any).buffer = (window as any).Buffer
4
+import { xrpIO } from 'xrpio';
5
+(window as any).xrpIO = xrpIO;
6
+declare const DATA_HASH: string
7
+
8
+const api = new xrpIO("wss://s.altnet.rippletest.net:51233")
9
+api.connect().then(async _ => {
10
+    const data = await api.treeRead([DATA_HASH]);
11
+    alert("Writing to document now")
12
+    document.write(data)
13
+})

+ 17
- 0
src/frontend/.browserslistrc View File

@@ -0,0 +1,17 @@
1
+# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2
+# For additional information regarding the format and rule options, please see:
3
+# https://github.com/browserslist/browserslist#queries
4
+
5
+# For the full list of supported browsers by the Angular framework, please see:
6
+# https://angular.io/guide/browser-support
7
+
8
+# You can see what browsers were selected by your queries by running:
9
+#   npx browserslist
10
+
11
+last 1 Chrome version
12
+last 1 Firefox version
13
+last 2 Edge major versions
14
+last 2 Safari major versions
15
+last 2 iOS major versions
16
+Firefox ESR
17
+not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

+ 108
- 0
src/frontend/angular.json View File

@@ -0,0 +1,108 @@
1
+{
2
+  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
+  "version": 1,
4
+  "newProjectRoot": "projects",
5
+  "projects": {
6
+    "angular-cli": {
7
+      "projectType": "application",
8
+      "schematics": {
9
+        "@schematics/angular:component": {
10
+          "style": "scss"
11
+        },
12
+        "@schematics/angular:application": {
13
+          "strict": true
14
+        }
15
+      },
16
+      "root": "",
17
+      "sourceRoot": "src",
18
+      "prefix": "app",
19
+      "architect": {
20
+        "build": {
21
+          "builder": "@angular-devkit/build-angular:browser",
22
+          "options": {
23
+            "outputPath": "dist/angular-cli",
24
+            "index": "src/index.html",
25
+            "main": "src/main.ts",
26
+            "polyfills": "src/polyfills.ts",
27
+            "tsConfig": "tsconfig.app.json",
28
+            "inlineStyleLanguage": "scss",
29
+            "assets": ["src/favicon.ico", "src/assets"],
30
+            "styles": [
31
+              "./node_modules/@cds/city/css/bundles/default.min.css",
32
+              "./node_modules/@cds/core/global.min.css",
33
+              "./node_modules/normalize.css/normalize.css",
34
+              "node_modules/@clr/icons/clr-icons.min.css",
35
+              "node_modules/@clr/ui/clr-ui.min.css",
36
+              "src/styles.scss"
37
+            ],
38
+            "scripts": []
39
+          },
40
+          "configurations": {
41
+            "production": {
42
+              "budgets": [
43
+                {
44
+                  "type": "initial",
45
+                  "maximumWarning": "3mb",
46
+                  "maximumError": "10mb"
47
+                },
48
+                {
49
+                  "type": "anyComponentStyle",
50
+                  "maximumWarning": "2kb",
51
+                  "maximumError": "4kb"
52
+                }
53
+              ],
54
+              "fileReplacements": [
55
+                {
56
+                  "replace": "src/environments/environment.ts",
57
+                  "with": "src/environments/environment.prod.ts"
58
+                }
59
+              ],
60
+              "outputHashing": "all"
61
+            },
62
+            "development": {
63
+              "buildOptimizer": false,
64
+              "optimization": false,
65
+              "vendorChunk": true,
66
+              "extractLicenses": false,
67
+              "sourceMap": true,
68
+              "namedChunks": true
69
+            }
70
+          },
71
+          "defaultConfiguration": "production"
72
+        },
73
+        "serve": {
74
+          "builder": "@angular-devkit/build-angular:dev-server",
75
+          "configurations": {
76
+            "production": {
77
+              "browserTarget": "angular-cli:build:production"
78
+            },
79
+            "development": {
80
+              "browserTarget": "angular-cli:build:development"
81
+            }
82
+          },
83
+          "defaultConfiguration": "development"
84
+        },
85
+        "extract-i18n": {
86
+          "builder": "@angular-devkit/build-angular:extract-i18n",
87
+          "options": {
88
+            "browserTarget": "angular-cli:build"
89
+          }
90
+        },
91
+        "test": {
92
+          "builder": "@angular-devkit/build-angular:karma",
93
+          "options": {
94
+            "main": "src/test.ts",
95
+            "polyfills": "src/polyfills.ts",
96
+            "tsConfig": "tsconfig.spec.json",
97
+            "karmaConfig": "karma.conf.js",
98
+            "inlineStyleLanguage": "scss",
99
+            "assets": ["src/favicon.ico", "src/assets"],
100
+            "styles": ["src/styles.scss"],
101
+            "scripts": []
102
+          }
103
+        }
104
+      }
105
+    }
106
+  },
107
+  "defaultProject": "angular-cli"
108
+}

+ 22103
- 0
src/frontend/package-lock.json
File diff suppressed because it is too large
View File


+ 55
- 0
src/frontend/package.json View File

@@ -0,0 +1,55 @@
1
+{
2
+  "name": "angular-cli",
3
+  "version": "0.0.0",
4
+  "scripts": {
5
+    "ng": "ng",
6
+    "postinstall": "npm run start",
7
+    "start": "ng serve",
8
+    "build": "npm run build-aot && npm run bundle",
9
+    "watch": "ng build --watch --configuration development",
10
+    "test": "ng test",
11
+    "build-aot": "ng build --aot --optimization --build-optimizer",
12
+    "bundle": "webpack --config webpack-bundle.config.js --progress",
13
+    "clean": "rm -rf dist/* build/*"
14
+  },
15
+  "private": true,
16
+  "dependencies": {
17
+    "@angular/animations": "~14.0.0",
18
+    "@angular/common": "~14.0.0",
19
+    "@angular/compiler": "~14.0.0",
20
+    "@angular/core": "~14.0.0",
21
+    "@angular/forms": "~14.0.0",
22
+    "@angular/platform-browser": "~14.0.0",
23
+    "@angular/platform-browser-dynamic": "~14.0.0",
24
+    "@angular/router": "~14.0.0",
25
+    "@cds/angular": "^6.0.0",
26
+    "@cds/city": "^1.1.0",
27
+    "@cds/core": "^6.0.0",
28
+    "@clr/angular": "~13.0.0",
29
+    "@clr/icons": "~13.0.0",
30
+    "@clr/ui": "~13.0.0",
31
+    "mini-css-extract-plugin": "^1.6.0",
32
+    "normalize.css": "^8.0.1",
33
+    "rxjs": "~6.6.0",
34
+    "style-loader": "^3.3.1",
35
+    "tslib": "^2.1.0",
36
+    "zone.js": "~0.11.4"
37
+  },
38
+  "devDependencies": {
39
+    "@angular-devkit/build-angular": "~14.0.0",
40
+    "@angular/cli": "~14.0.0",
41
+    "@angular/compiler-cli": "~14.0.0",
42
+    "@types/jasmine": "~3.6.0",
43
+    "@types/node": "^12.11.1",
44
+    "css-loader": "^6.7.2",
45
+    "html-webpack-plugin": "^5.5.0",
46
+    "inline-chunk-html-plugin": "^1.1.1",
47
+    "jasmine-core": "~3.7.0",
48
+    "karma": "~6.3.0",
49
+    "karma-chrome-launcher": "~3.1.0",
50
+    "karma-coverage": "~2.0.3",
51
+    "karma-jasmine": "~4.0.0",
52
+    "karma-jasmine-html-reporter": "^1.5.0",
53
+    "typescript": "~4.7.0"
54
+  }
55
+}

+ 10
- 0
src/frontend/src/app/app-routing.module.ts View File

@@ -0,0 +1,10 @@
1
+import { NgModule } from '@angular/core';
2
+import { RouterModule, Routes } from '@angular/router';
3
+
4
+const routes: Routes = [];
5
+
6
+@NgModule({
7
+  imports: [RouterModule.forRoot(routes)],
8
+  exports: [RouterModule]
9
+})
10
+export class AppRoutingModule {}

+ 26
- 0
src/frontend/src/app/app.component.html View File

@@ -0,0 +1,26 @@
1
+<div class="main-container">
2
+<header class="header-2">
3
+  <div class="branding">
4
+    <a class="nav-link">
5
+      <cds-icon shape="home" size="lg"></cds-icon>
6
+      <span class="title">Clarity</span>
7
+    </a>
8
+  </div>
9
+  <div class="header-nav">
10
+    <a class="active nav-link nav-text">Home</a>
11
+  </div>
12
+</header>
13
+<div class="content-container">
14
+  <div class="content-area">
15
+    <h3>Clarity Starter Instructions:</h3>
16
+
17
+    <ul>
18
+      <li>Start by clicking Fork in the toolbar above.</li>
19
+      <li>Implement the problem in the new editor.</li>
20
+      <li>
21
+        Save the result, and share the url in a GitHub or StackOverflow issue.
22
+      </li>
23
+    </ul>
24
+  </div>
25
+</div>
26
+</div>

+ 0
- 0
src/frontend/src/app/app.component.scss View File


+ 10
- 0
src/frontend/src/app/app.component.ts View File

@@ -0,0 +1,10 @@
1
+import { Component } from '@angular/core';
2
+
3
+@Component({
4
+  selector: 'app-root',
5
+  templateUrl: './app.component.html',
6
+  styleUrls: ['./app.component.scss'],
7
+})
8
+export class AppComponent {
9
+  title = 'angular-cli';
10
+}

+ 21
- 0
src/frontend/src/app/app.module.ts View File

@@ -0,0 +1,21 @@
1
+import { NgModule } from '@angular/core';
2
+import { BrowserModule } from '@angular/platform-browser';
3
+
4
+import { AppRoutingModule } from './app-routing.module';
5
+import { AppComponent } from './app.component';
6
+import { CdsModule } from '@cds/angular';
7
+import { ClarityModule } from '@clr/angular';
8
+
9
+import { ClarityIcons, homeIcon } from '@cds/core/icon';
10
+
11
+@NgModule({
12
+  declarations: [AppComponent],
13
+  imports: [BrowserModule, AppRoutingModule, ClarityModule, CdsModule],
14
+  providers: [],
15
+  bootstrap: [AppComponent],
16
+})
17
+export class AppModule {
18
+  constructor() {
19
+    ClarityIcons.addIcons(homeIcon);
20
+  }
21
+}

+ 3
- 0
src/frontend/src/environments/environment.prod.ts View File

@@ -0,0 +1,3 @@
1
+export const environment = {
2
+  production: true
3
+};

+ 16
- 0
src/frontend/src/environments/environment.ts View File

@@ -0,0 +1,16 @@
1
+// This file can be replaced during build by using the `fileReplacements` array.
2
+// `ng build` replaces `environment.ts` with `environment.prod.ts`.
3
+// The list of file replacements can be found in `angular.json`.
4
+
5
+export const environment = {
6
+  production: false
7
+};
8
+
9
+/*
10
+ * For easier debugging in development mode, you can import the following file
11
+ * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12
+ *
13
+ * This import should be commented out in production mode because it will have a negative impact
14
+ * on performance if an error is thrown.
15
+ */
16
+// import 'zone.js/plugins/zone-error';  // Included with Angular CLI.

+ 14
- 0
src/frontend/src/index.html View File

@@ -0,0 +1,14 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+  <head>
4
+    <meta charset="utf-8" />
5
+    <title>AngularCli</title>
6
+    <base href="" />
7
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
8
+    <link rel="icon" type="image/x-icon" href="favicon.ico" />
9
+  </head>
10
+
11
+  <body cds-text="body">
12
+    <app-root></app-root>
13
+  </body>
14
+</html>

+ 13
- 0
src/frontend/src/main.ts View File

@@ -0,0 +1,13 @@
1
+import { enableProdMode } from '@angular/core';
2
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3
+
4
+import { AppModule } from './app/app.module';
5
+import { environment } from './environments/environment';
6
+
7
+if (environment.production) {
8
+  enableProdMode();
9
+}
10
+
11
+platformBrowserDynamic()
12
+  .bootstrapModule(AppModule)
13
+  .catch(err => console.error(err));

+ 64
- 0
src/frontend/src/polyfills.ts View File

@@ -0,0 +1,64 @@
1
+/**
2
+ * This file includes polyfills needed by Angular and is loaded before the app.
3
+ * You can add your own extra polyfills to this file.
4
+ *
5
+ * This file is divided into 2 sections:
6
+ *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7
+ *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
8
+ *      file.
9
+ *
10
+ * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11
+ * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12
+ * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13
+ *
14
+ * Learn more in https://angular.io/guide/browser-support
15
+ */
16
+
17
+/***************************************************************************************************
18
+ * BROWSER POLYFILLS
19
+ */
20
+
21
+/**
22
+ * IE11 requires the following for NgClass support on SVG elements
23
+ */
24
+// import 'classlist.js';  // Run `npm install --save classlist.js`.
25
+
26
+/**
27
+ * Web Animations `@angular/platform-browser/animations`
28
+ * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
29
+ * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
30
+ */
31
+// import 'web-animations-js';  // Run `npm install --save web-animations-js`.
32
+
33
+/**
34
+ * By default, zone.js will patch all possible macroTask and DomEvents
35
+ * user can disable parts of macroTask/DomEvents patch by setting following flags
36
+ * because those flags need to be set before `zone.js` being loaded, and webpack
37
+ * will put import in the top of bundle, so user need to create a separate file
38
+ * in this directory (for example: zone-flags.ts), and put the following flags
39
+ * into that file, and then add the following code before importing zone.js.
40
+ * import './zone-flags';
41
+ *
42
+ * The flags allowed in zone-flags.ts are listed here.
43
+ *
44
+ * The following flags will work for all browsers.
45
+ *
46
+ * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
47
+ * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
48
+ * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
49
+ *
50
+ *  in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
51
+ *  with the following flag, it will bypass `zone.js` patch for IE/Edge
52
+ *
53
+ *  (window as any).__Zone_enable_cross_context_check = true;
54
+ *
55
+ */
56
+
57
+/***************************************************************************************************
58
+ * Zone JS is required by default for Angular itself.
59
+ */
60
+import 'zone.js'; // Included with Angular CLI.
61
+
62
+/***************************************************************************************************
63
+ * APPLICATION IMPORTS
64
+ */

+ 4
- 0
src/frontend/src/styles.scss View File

@@ -0,0 +1,4 @@
1
+@import '~modern-normalize/modern-normalize.css';
2
+@import '~@cds/core/global.min.css';
3
+@import '~@cds/city/css/bundles/default.min.css';
4
+@import '~@cds/core/styles/theme.dark.min.css';

+ 15
- 0
src/frontend/tsconfig.app.json View File

@@ -0,0 +1,15 @@
1
+/* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+{
3
+  "extends": "./tsconfig.json",
4
+  "compilerOptions": {
5
+    "outDir": "./out-tsc/app",
6
+    "types": []
7
+  },
8
+  "files": [
9
+    "src/main.ts",
10
+    "src/polyfills.ts"
11
+  ],
12
+  "include": [
13
+    "src/**/*.d.ts"
14
+  ]
15
+}

+ 27
- 0
src/frontend/tsconfig.json View File

@@ -0,0 +1,27 @@
1
+/* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+{
3
+  "compileOnSave": false,
4
+  "compilerOptions": {
5
+    "baseUrl": "./",
6
+    "outDir": "./dist/out-tsc",
7
+    "forceConsistentCasingInFileNames": true,
8
+    "strict": true,
9
+    "noImplicitReturns": true,
10
+    "noFallthroughCasesInSwitch": true,
11
+    "sourceMap": true,
12
+    "declaration": false,
13
+    "downlevelIteration": true,
14
+    "experimentalDecorators": true,
15
+    "moduleResolution": "node",
16
+    "importHelpers": true,
17
+    "target": "ES2020",
18
+    "module": "es2020",
19
+    "lib": ["es2018", "dom"]
20
+  },
21
+  "angularCompilerOptions": {
22
+    "enableI18nLegacyMessageIdFormat": false,
23
+    "strictInjectionParameters": true,
24
+    "strictInputAccessModifiers": true,
25
+    "strictTemplates": true
26
+  }
27
+}

+ 44
- 0
src/frontend/webpack-bundle.config.js View File

@@ -0,0 +1,44 @@
1
+const HtmlWebpackPlugin = require('html-webpack-plugin')
2
+const InlineChunkHtmlPlugin = require('inline-chunk-html-plugin')
3
+const webpack = require('webpack')
4
+const path = require('path')
5
+const fs = require('fs')
6
+
7
+const distDir = path.resolve(__dirname, 'dist', 'angular-cli')
8
+const buildDir = path.resolve(__dirname, 'build')
9
+const srcDir = path.resolve(__dirname, 'src')
10
+
11
+module.exports = {
12
+    mode: 'production',
13
+    target: 'web',
14
+    entry: fs.readdirSync(distDir)
15
+        .filter(name => name.match(/(\.(js|css))$/))
16
+        .map(name => path.resolve(distDir, name)),
17
+    output: {
18
+        publicPath: '',
19
+        filename: '[name].js',
20
+        path: buildDir,
21
+    },
22
+    resolve: {
23
+        extensions: ['', '.js', '.jsx', '.css'],
24
+    },
25
+    plugins: [
26
+        new HtmlWebpackPlugin({
27
+            inject: "body",
28
+            template: path.resolve(srcDir, 'index.html'),
29
+        }),
30
+        new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/.*/]),
31
+    ],
32
+    optimization: {
33
+    },
34
+    module: {
35
+        rules: [
36
+            {
37
+                test: /\.css$/i,
38
+                use: ["style-loader", "css-loader"],
39
+            },
40
+        ],
41
+    },
42
+    externals: {
43
+    },
44
+}

+ 19
- 0
tsconfig.json View File

@@ -0,0 +1,19 @@
1
+{
2
+  "compilerOptions": {
3
+    "strictPropertyInitialization": false,
4
+    "noImplicitAny": false,
5
+    "target": "esNext",
6
+    "declaration": true,
7
+    "module": "commonjs",
8
+    "moduleResolution": "node",
9
+    "strict": true,
10
+    "experimentalDecorators": true,
11
+    "emitDecoratorMetadata": true,
12
+    "baseUrl": "./",
13
+    "outDir": "./lib",
14
+    "strictNullChecks": false,
15
+    "esModuleInterop": true
16
+  },
17
+  "include": ["src", "test"],
18
+  "exclude": ["src/gui"]
19
+}

+ 62
- 0
webpack.gateway.js View File

@@ -0,0 +1,62 @@
1
+const path = require('path');
2
+const webpack = require('webpack');
3
+const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
4
+
5
+if(!process.env['DATA_HASH']){
6
+  console.log("Environment DATA_HASH not set")
7
+  process.exit(1)
8
+}else{
9
+  console.log(`Webpacking Gateway with DATA_HASH=${process.env['DATA_HASH']}`)
10
+}
11
+
12
+module.exports = {
13
+  mode: 'production',
14
+  target: "web",
15
+  entry: path.resolve(__dirname, 'src', 'Gateway.ts'),
16
+  output: {
17
+    path: path.resolve(__dirname, 'build', 'gateway'),
18
+    filename: '[name].js'
19
+  },
20
+  plugins: [
21
+    new webpack.ProvidePlugin({
22
+      process: 'process/browser',
23
+    }),
24
+    //new BundleAnalyzerPlugin(),
25
+    //new webpack.IgnorePlugin(/.*ripple-lib.*/),
26
+    new webpack.DefinePlugin({
27
+      DATA_HASH: JSON.stringify(process.env['DATA_HASH'])
28
+    })
29
+  ],
30
+  resolve: {
31
+    // Add `.ts` and `.tsx` as a resolvable extension.
32
+    extensions: [".ts", ".tsx", ".js"],
33
+    fallback: {
34
+      "fs": false,
35
+      "tls": false,
36
+      "net": false,
37
+      "path": false,
38
+      "zlib": false,
39
+      "http": false,
40
+      "https": false,
41
+      "stream": false,
42
+      "crypto": false,
43
+      "Buffer": require.resolve('buffer'),
44
+      "crypto-browserify": require.resolve('crypto-browserify'),
45
+    }
46
+  },
47
+  externals: {
48
+    'lodash': ['_'],
49
+    'xrpl': ['xrpl'],
50
+    'ripple-lib': ['ripple'],
51
+    'RippleAPI': ['ripple-lib', 'RippleAPI'],
52
+    'bn.js': ['BN'],
53
+    'Buffer': ['buffer'],
54
+    'buffer': ['buffer'],
55
+    'zlib': ['browserifyZlib']
56
+  },
57
+  module: {
58
+    rules: [
59
+      { test: /\.ts?$/, loader: "ts-loader", }
60
+    ]
61
+  },
62
+}

+ 50
- 0
webpack.gui.js View File

@@ -0,0 +1,50 @@
1
+const path = require('path');
2
+const webpack = require('webpack');
3
+
4
+module.exports = {
5
+  mode: 'production',
6
+  target: "web",
7
+  entry: path.resolve(__dirname, 'src', 'Browser.ts'),
8
+  output: {
9
+    path: path.resolve(__dirname, 'build', 'gui'),
10
+    filename: '[name].js',
11
+  },
12
+  plugins: [
13
+    new webpack.ProvidePlugin({
14
+      process: 'process/browser',
15
+    }),
16
+  ],
17
+  resolve: {
18
+    extensions: [".ts", ".tsx", ".js"],
19
+    fallback: {
20
+      "fs": false,
21
+      "tls": false,
22
+      "net": false,
23
+      "path": false,
24
+      "zlib": false,
25
+      "http": false,
26
+      "https": false,
27
+      "stream": false,
28
+      "crypto": false,
29
+      "Buffer": require.resolve('buffer'),
30
+      "crypto-browserify": require.resolve('crypto-browserify'),
31
+    }
32
+  },
33
+  externals: {
34
+    'lodash': ['_'],
35
+    'ripple-lib': ['ripple'],
36
+    'RippleAPI': ['ripple-lib', 'RippleAPI'],
37
+    'bn.js': ['BN'],
38
+    'Buffer': ['buffer'],
39
+    'buffer': ['buffer'],
40
+    'zlib': ['browserifyZlib']
41
+  },
42
+  module: {
43
+    rules: [
44
+      { test: /\.ts?$/, loader: "ts-loader", }
45
+    ]
46
+  },
47
+  optimization:{
48
+    minimize: false
49
+  }
50
+}

Loading…
Cancel
Save