diff --git a/Index.ts b/Index.ts new file mode 100644 index 0000000..f307de2 --- /dev/null +++ b/Index.ts @@ -0,0 +1,7 @@ +import * as Back from './src/Backend'; +import * as Front from './src/Frontend'; + +export { + Back as Backend, + Front as Frontend +} \ No newline at end of file diff --git a/package.json b/package.json index c0e4e72..d52c6fa 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,15 @@ { "name": "rpclibrary", - "version": "1.0.2", + "version": "1.0.3", "description": "", + "main": "./js/Index.js", "scripts": { "tsc": "tsc", - "webpack": "webpack", - "build-lib": "webpack --config ./src/webpack.js", - "build-test": "webpack --config ./test/webpack.js", - "build": "npm run clean && npm run build-lib && npm run build-test && mv js/**/*.d.ts .", - "clean": "rm -rf ./*.js ./*.d.ts js" + "webpack": "webpack --config ./src/webpack.js", + "backend": "node js/test/TestBackend.js", + "frontend": "node js/test/TestFrontend.js", + "build": "npm run clean && tsc && npm run webpack", + "clean": "rm -rf js" }, "author": "", "license": "ISC", @@ -29,7 +30,6 @@ "uuid": "^3.3.3" }, "files": [ - "*.js", - "*.d.ts" + "js" ] } diff --git a/src/webpack.js b/src/webpack.js index 18af705..ea871b9 100644 --- a/src/webpack.js +++ b/src/webpack.js @@ -3,39 +3,12 @@ const path = require('path'); const frontendConf = { mode: 'production', target: "web", - entry: path.resolve(__dirname, 'Frontend.ts'), + entry: path.resolve(__dirname, '..', 'js', 'src', 'Frontend.js'), output: { - path: path.resolve(__dirname, '..'), + path: path.resolve(__dirname, '..', 'js', 'src'), filename: "Frontend.js", libraryTarget: 'commonjs', }, - module: { - rules: [ - { test: /\.ts?$/, loader: "ts-loader" } - ] - }, - resolve: { - extensions: [".ts", ".tsx", ".js"] - }, - optimization: { - minimize: true, - }, -} - -const backendConf = { - mode: 'production', - target: "node", - entry: path.resolve(__dirname, 'Backend.ts'), - output: { - path: path.resolve(__dirname, '..'), - filename: "Backend.js", - libraryTarget: 'commonjs' - }, - module: { - rules: [ - { test: /\.ts?$/, loader: "ts-loader" } - ] - }, resolve: { extensions: [".ts", ".tsx", ".js"] }, @@ -44,4 +17,4 @@ const backendConf = { }, } -module.exports = [backendConf, frontendConf] +module.exports = [frontendConf] diff --git a/test/webpack.js b/test/webpack.js deleted file mode 100644 index 4d7df95..0000000 --- a/test/webpack.js +++ /dev/null @@ -1,47 +0,0 @@ -const path = require('path'); - -const frontendConf = { - mode: 'production', - target: "web", - entry: path.resolve(__dirname, 'TestFrontend.ts'), - output: { - path: path.resolve(__dirname, '..'), - filename: "TestFrontend.js", - libraryTarget: 'commonjs', - }, - module: { - rules: [ - { test: /\.ts?$/, loader: "ts-loader" } - ] - }, - resolve: { - extensions: [".ts", ".tsx", ".js"] - }, - optimization: { - minimize: true, - }, -} - -const backendConf = { - 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, - }, -} - -module.exports = [backendConf, frontendConf] diff --git a/tsconfig.json b/tsconfig.json index b00e8bb..4de165e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,6 +9,6 @@ "strict": true, "experimentalDecorators": true }, - "include": ["src/**/*.ts", "test/**/*.ts"], + "include": ["src/**/*.ts", "test/**/*.ts", "Index.ts"], "exclude": ["node_modules"] } \ No newline at end of file