This commit is contained in:
2019-09-18 12:32:29 +02:00
parent e3f09335d8
commit 094fb386db
11 changed files with 403 additions and 239 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import { Backend } from '../src/Backend'
import { Server } from '../src/Backend'
const testServer = new Backend(20000, [{
const testServer = new Server(20000, [{
name: "HelloWorldRPCGroup",
publicRPCs: () => [],
localRPCs: () => [{
+2 -2
View File
@@ -1,6 +1,6 @@
import { Frontend } from '../src/Frontend'
import { Client } from '../src/Frontend'
const testClient = new Frontend(20000, 'localhost')
const testClient = new Client(20000, 'localhost')
testClient.connect().then(_ => {
testClient.info().then(console.log)
testClient["HelloWorldRPCGroup"].echo("x").then(console.log)
+23 -77
View File
@@ -1,12 +1,12 @@
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
const frontendConf = {
mode: 'production',
target: "web",
entry: path.resolve(__dirname, 'TestFrontend.ts'),
output: {
path: path.resolve(__dirname, 'lib'),
path: path.resolve(__dirname, '..'),
filename: "TestFrontend.js",
libraryTarget: 'commonjs',
},
module: {
@@ -19,83 +19,29 @@ const frontendConf = {
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: true,
exclude: [
/\.\/(.*)\/.ts/,
/\.\/(.*).ts/,
],
}),
],
},
}
const backendConf = {
mode: 'production',
target: "node",
output: {
path: path.resolve(__dirname, 'lib'),
libraryTarget: 'commonjs',
},
module: {
rules: [
{ test: /\.ts?$/, loader: "ts-loader" }
]
},
resolve: {
extensions: [".ts", ".tsx", ".js"]
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: true,
exclude: [
/\.\/(.*)\/.ts/,
/\.\/(.*).ts/,
],
}),
],
},
mode: 'production',
target: "node",
entry: path.resolve(__dirname, 'TestBackend.ts'),
output: {
path: path.resolve(__dirname, '..'),
filename: "TestBackend.js",
libraryTarget: 'commonjs',
},
module: {
rules: [
{ test: /\.ts?$/, loader: "ts-loader" }
]
},
resolve: {
extensions: [".ts", ".tsx", ".js"]
},
optimization: {
minimize: false,
},
}
const clientConf = {
...frontendConf,
...{
entry: path.resolve(__dirname, 'src', 'Client.ts'),
output: {
filename: 'Frontend.js',
}
}
}
const clientTestConf = {
...frontendConf,
...{
entry: path.resolve(__dirname, 'test', 'TestClient.ts'),
output: {
filename: 'TestFrontend.js',
}
}
}
const serverConf = {
...backendConf,
...{
entry: path.resolve(__dirname, 'src', 'Server.ts'),
output: {
filename: 'Backend.js',
}
}
}
const serverTestConf = {
...backendConf,
...{
entry: path.resolve(__dirname, 'test', 'TestServer.ts'),
output: {
filename: 'TestBackend.js',
}
}
}
module.exports = [clientConf, clientTestConf, serverConf, serverTestConf]
module.exports = [backendConf, frontendConf]