Browse Source

werks

master
Daniel Hübleitner 4 years ago
parent
commit
b39b9347ed
5 changed files with 19 additions and 86 deletions
  1. 7
    0
      Index.ts
  2. 8
    8
      package.json
  3. 3
    30
      src/webpack.js
  4. 0
    47
      test/webpack.js
  5. 1
    1
      tsconfig.json

+ 7
- 0
Index.ts View File

@@ -0,0 +1,7 @@
1
+import * as Back from './src/Backend';
2
+import * as Front from './src/Frontend';
3
+
4
+export {
5
+    Back as Backend,
6
+    Front as Frontend
7
+}

+ 8
- 8
package.json View File

@@ -1,14 +1,15 @@
1 1
 {
2 2
   "name": "rpclibrary",
3
-  "version": "1.0.2",
3
+  "version": "1.0.3",
4 4
   "description": "",
5
+  "main": "./js/Index.js",
5 6
   "scripts": {
6 7
     "tsc": "tsc",
7
-    "webpack": "webpack",
8
-    "build-lib": "webpack --config ./src/webpack.js",
9
-    "build-test": "webpack --config ./test/webpack.js",
10
-    "build": "npm run clean && npm run build-lib && npm run build-test && mv js/**/*.d.ts .",
11
-    "clean": "rm -rf ./*.js ./*.d.ts js"
8
+    "webpack": "webpack --config ./src/webpack.js",
9
+    "backend": "node js/test/TestBackend.js",
10
+    "frontend": "node js/test/TestFrontend.js",
11
+    "build": "npm run clean && tsc && npm run webpack",
12
+    "clean": "rm -rf js"
12 13
   },
13 14
   "author": "",
14 15
   "license": "ISC",
@@ -29,7 +30,6 @@
29 30
     "uuid": "^3.3.3"
30 31
   },
31 32
   "files": [
32
-    "*.js",
33
-    "*.d.ts"
33
+    "js"
34 34
   ]
35 35
 }

+ 3
- 30
src/webpack.js View File

@@ -3,39 +3,12 @@ const path = require('path');
3 3
 const frontendConf = {
4 4
   mode: 'production',
5 5
   target: "web",
6
-  entry: path.resolve(__dirname, 'Frontend.ts'),
6
+  entry: path.resolve(__dirname, '..', 'js', 'src', 'Frontend.js'),
7 7
   output: {
8
-      path: path.resolve(__dirname, '..'),
8
+      path: path.resolve(__dirname, '..', 'js', 'src'),
9 9
       filename: "Frontend.js",
10 10
       libraryTarget: 'commonjs',
11 11
   },
12
-  module: {
13
-    rules: [
14
-      { test: /\.ts?$/, loader: "ts-loader" }
15
-    ]
16
-  },
17
-  resolve: {
18
-    extensions: [".ts", ".tsx", ".js"]
19
-  },
20
-  optimization: {
21
-    minimize: true,
22
-  },
23
-}
24
-
25
-const backendConf = {
26
-  mode: 'production',
27
-  target: "node",
28
-  entry: path.resolve(__dirname, 'Backend.ts'),
29
-  output: {
30
-      path: path.resolve(__dirname, '..'),
31
-      filename: "Backend.js",
32
-      libraryTarget: 'commonjs'
33
-  },
34
-  module: {
35
-    rules: [
36
-      { test: /\.ts?$/, loader: "ts-loader" }
37
-    ]
38
-  },
39 12
   resolve: {
40 13
     extensions: [".ts", ".tsx", ".js"]
41 14
   },
@@ -44,4 +17,4 @@ const backendConf = {
44 17
   },
45 18
 }
46 19
 
47
-module.exports =  [backendConf, frontendConf]
20
+module.exports =  [frontendConf]

+ 0
- 47
test/webpack.js View File

@@ -1,47 +0,0 @@
1
-const path = require('path');
2
-
3
-const frontendConf = {
4
-  mode: 'production',
5
-  target: "web",
6
-  entry: path.resolve(__dirname, 'TestFrontend.ts'),
7
-  output: {
8
-      path: path.resolve(__dirname, '..'),
9
-      filename: "TestFrontend.js",
10
-      libraryTarget: 'commonjs',
11
-  },
12
-  module: {
13
-    rules: [
14
-      { test: /\.ts?$/, loader: "ts-loader" }
15
-    ]
16
-  },
17
-  resolve: {
18
-    extensions: [".ts", ".tsx", ".js"]
19
-  },
20
-  optimization: {
21
-    minimize: true,
22
-  },
23
-}
24
-
25
-const backendConf = {
26
-  mode: 'production',
27
-  target: "node",
28
-  entry: path.resolve(__dirname, 'TestBackend.ts'),
29
-  output: {
30
-      path: path.resolve(__dirname, '..'),
31
-      filename: "TestBackend.js",
32
-      libraryTarget: 'commonjs',
33
-  },
34
-  module: {
35
-    rules: [
36
-      { test: /\.ts?$/, loader: "ts-loader" }
37
-    ]
38
-  },
39
-  resolve: {
40
-    extensions: [".ts", ".tsx", ".js"]
41
-  },
42
-  optimization: {
43
-    minimize: false,
44
-  },
45
-}
46
-
47
-module.exports =  [backendConf, frontendConf]

+ 1
- 1
tsconfig.json View File

@@ -9,6 +9,6 @@
9 9
       "strict": true,
10 10
       "experimentalDecorators": true
11 11
     },
12
-    "include": ["src/**/*.ts", "test/**/*.ts"],
12
+    "include": ["src/**/*.ts", "test/**/*.ts", "Index.ts"],
13 13
     "exclude": ["node_modules"]
14 14
   }

Loading…
Cancel
Save