diff --git a/libraries/botframework-connector/package.json b/libraries/botframework-connector/package.json index 8523eddaf3..6ed26a8a80 100644 --- a/libraries/botframework-connector/package.json +++ b/libraries/botframework-connector/package.json @@ -40,6 +40,7 @@ "mocha": "^6.2.3", "nock": "^11.9.1", "nyc": "^15.1.0", + "rimraf": "^3.0.2", "should": "^13.2.3", "shx": "^0.3.2", "source-map-support": "^0.5.3", @@ -49,8 +50,8 @@ }, "scripts": { "build": "tsc", - "postbuild": "shx cp lib/index.js lib/browser.js | browserify --debug lib/browser.js | exorcist lib/browser.map.js | sponge lib/browser.js", - "clean": "erase /q /s .\\lib", + "postbuild": "shx cp lib/index.js lib/browser.js | browserify -s BFC --debug lib/browser.js | exorcist lib/browser.js.map | sponge lib/browser.js", + "clean": "rimraf q s lib", "set-version": "npm version --allow-same-version ${Version}", "test": "tsc && nyc mocha tests/ --timeout 60000 --inspect" }, diff --git a/libraries/botframework-streaming/.gitignore b/libraries/botframework-streaming/.gitignore index ae8afb3dab..379c65a3f6 100644 --- a/libraries/botframework-streaming/.gitignore +++ b/libraries/botframework-streaming/.gitignore @@ -1,5 +1,5 @@ -/browser -/lib -/node_modules +es5 +lib +node_modules *.js.map -/coverage/** +coverage/** diff --git a/libraries/botframework-streaming/package.json b/libraries/botframework-streaming/package.json index f897091986..2bdfd06f3c 100644 --- a/libraries/botframework-streaming/package.json +++ b/libraries/botframework-streaming/package.json @@ -20,7 +20,7 @@ "url": "https://github.com/microsoft/botbuilder-js.git" }, "main": "lib/index.js", - "browser": "browser/index-browser.js", + "browser": "lib/index-browser.js", "typings": "lib/index.d.ts", "dependencies": { "@types/ws": "^6.0.3", @@ -31,24 +31,31 @@ "@microsoft/api-extractor": "^7.7.12", "@types/chai": "^4.1.7", "@types/node": "^10.17.27", + "browserify": "16.5.2", "chai": "^4.2.0", + "exorcist": "^1.0.1", "mocha": "^6.2.3", + "npm-run-all": "^4.1.5", "nyc": "^15.1.0", + "rimraf": "^3.0.2", "sinon": "^7.5.0", + "sponge": "^0.1.0", "ts-node": "^4.1.0", "typescript": "3.5.3" }, "scripts": { - "build": "tsc -p tsconfig.json && tsc -p tsconfig-browser.json", + "build": "npm-run-all -p build:lib build:es5", + "build:lib": "tsc -p tsconfig.json", + "build:es5": "tsc -p tsconfig-es5.json", + "postbuild": "browserify -s BFSE --debug es5/index-browser.js | exorcist lib/index-browser.js.map | sponge lib/index-browser.js", "build:rollup": "npm run clean && npm run build && api-extractor run --verbose --local", - "clean": "rmdir /q /s lib browser", + "clean": "rimraf q s lib es5", "set-version": "npm version --allow-same-version ${Version}", "test": "npm run build && nyc mocha tests/", "test:compat": "api-extractor run --verbose" }, "files": [ "lib", - "src", - "browser" + "src" ] } diff --git a/libraries/botframework-streaming/tests/WebSocket.test.js b/libraries/botframework-streaming/tests/WebSocket.test.js index 1920dfacde..e2669f55e8 100644 --- a/libraries/botframework-streaming/tests/WebSocket.test.js +++ b/libraries/botframework-streaming/tests/WebSocket.test.js @@ -2,7 +2,7 @@ const { expect } = require('chai'); const { spy } = require('sinon'); const { RequestHandler, StreamingRequest, WebSocketClient, WebSocketServer } = require('../'); -const { BrowserWebSocket } = require('../browser/index-browser'); +const { BrowserWebSocket } = require('../lib/index-browser'); const { WebSocketTransport } = require('../lib/webSocket/webSocketTransport'); const { FauxSock } = require('./helpers'); diff --git a/libraries/botframework-streaming/tsconfig-browser.json b/libraries/botframework-streaming/tsconfig-browser.json deleted file mode 100644 index 06fd2efaa0..0000000000 --- a/libraries/botframework-streaming/tsconfig-browser.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["dom", "es2015"], - "module": "commonjs", - "declaration": true, - "declarationMap": true, - "sourceMap": true, - "outDir": "./browser", - "rootDir": "./src", - "types" : ["node"] - }, - "exclude": [ - "browser", - "lib", - "node_modules", - "src/index.ts", - "src/namedPipe", - "src/webSocket/index.ts", - "src/webSocket/node*.ts", - "src/webSocket/factories" - ] -} diff --git a/libraries/botframework-streaming/tsconfig-es5.json b/libraries/botframework-streaming/tsconfig-es5.json new file mode 100644 index 0000000000..a15c3c74d8 --- /dev/null +++ b/libraries/botframework-streaming/tsconfig-es5.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "lib": ["es2015", "dom"], + "target": "es5", + "outDir": "es5" + }, + "exclude": [ + "**/*node*.ts" + ] +} diff --git a/libraries/botframework-streaming/tsconfig.json b/libraries/botframework-streaming/tsconfig.json index 9654c027db..9b5e5c88b1 100644 --- a/libraries/botframework-streaming/tsconfig.json +++ b/libraries/botframework-streaming/tsconfig.json @@ -10,10 +10,10 @@ "rootDir": "./src", "types" : ["node"] }, + "include": [ + "src/**/*" + ], "exclude": [ - "**/*browser*.ts", - "browser", - "lib", - "node_modules" + "**/*browser*.ts" ] -} \ No newline at end of file +}