From e39caf0353c750d91a39d919497598cbc9bcf1cf Mon Sep 17 00:00:00 2001 From: Fabio Bottan Date: Sat, 7 Sep 2019 19:58:51 +0100 Subject: [PATCH 01/17] Added package-lock in gitignore and typedoc upgrade --- .gitignore | 3 +++ package.json | 2 +- src/package.json | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6b66814..ee182d4 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,6 @@ yarn-error.log # System Files .DS_Store Thumbs.db + +# NPM lock +package-lock.json diff --git a/package.json b/package.json index f738224..28959a0 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "ts-node": "^7.0.1", "tslint": "^5.11.0", "tslint-config-valorsoft": "^2.2.1", - "typedoc": "^0.13.0", + "typedoc": "^0.15.0", "typescript": "~3.2.4", "wallaby-webpack": "^3.9.13", "webdriver-manager": "^12.1.0", diff --git a/src/package.json b/src/package.json index e455b11..0816a04 100644 --- a/src/package.json +++ b/src/package.json @@ -48,5 +48,6 @@ "lib": { "entryFile": "index.ts" } - } + }, + "dependencies": {} } From 1d6e38591284597b92288e2d6fe754e3172bbb2a Mon Sep 17 00:00:00 2001 From: Fabio Bottan Date: Sun, 15 Sep 2019 15:57:34 +0100 Subject: [PATCH 02/17] Step 1 upgrade Angular8 --- demo/offline_bot/browserslist | 12 ++++++++++++ demo/offline_bot/package.json | 2 +- package.json | 29 ++++++++++++++--------------- src/package.json | 14 +++++++------- tsconfig.json | 5 +++-- 5 files changed, 37 insertions(+), 25 deletions(-) create mode 100644 demo/offline_bot/browserslist diff --git a/demo/offline_bot/browserslist b/demo/offline_bot/browserslist new file mode 100644 index 0000000..8084853 --- /dev/null +++ b/demo/offline_bot/browserslist @@ -0,0 +1,12 @@ +# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries + +# You can see what browsers were selected by your queries by running: +# npx browserslist + +> 0.5% +last 2 versions +Firefox ESR +not dead +not IE 9-11 # For IE 9-11 support, remove 'not'. \ No newline at end of file diff --git a/demo/offline_bot/package.json b/demo/offline_bot/package.json index b7c1136..67995c9 100644 --- a/demo/offline_bot/package.json +++ b/demo/offline_bot/package.json @@ -46,6 +46,6 @@ "protractor": "~5.4.1", "ts-node": "~7.0.1", "tslint": "~5.11.0", - "typescript": "~3.2.4" + "typescript": "~3.5.3" } } diff --git a/package.json b/package.json index 28959a0..0b11919 100644 --- a/package.json +++ b/package.json @@ -28,18 +28,17 @@ }, "dependencies": {}, "devDependencies": { - "@angular-devkit/build-angular": "^0.13.4", - "@angular/cli": "^7.0.5", - "@angular/common": "^7.0.3", - "@angular/compiler": "^7.0.3", - "@angular/compiler-cli": "^7.0.3", - "@angular/core": "^7.0.3", - "@angular/forms": "^7.0.3", - "@angular/http": "^7.0.3", - "@angular/language-service": "^7.0.3", - "@angular/platform-browser": "^7.0.3", - "@angular/platform-browser-dynamic": "^7.0.3", - "@angular/router": "^7.0.3", + "@angular-devkit/build-angular": "~0.803.4", + "@angular/cli": "^8.3.4", + "@angular/common": "^8.2.6", + "@angular/compiler": "^8.2.6", + "@angular/compiler-cli": "^8.2.6", + "@angular/core": "^8.2.6", + "@angular/forms": "^8.2.6", + "@angular/language-service": "^8.2.6", + "@angular/platform-browser": "^8.2.6", + "@angular/platform-browser-dynamic": "^8.2.6", + "@angular/router": "^8.2.6", "@angular/tsc-wrapped": "^4.4.6", "@types/jasmine": "^2.8.11", "@types/marked": "^0.4.2", @@ -48,7 +47,7 @@ "chokidar-cli": "^1.2.1", "classlist-polyfill": "^1.2.0", "codecov": "^3.1.0", - "codelyzer": "^4.5.0", + "codelyzer": "^5.0.1", "conventional-changelog-cli": "^2.0.11", "conventional-github-releaser": "^3.1.2", "core-js": "^2.5.7", @@ -82,9 +81,9 @@ "tslint": "^5.11.0", "tslint-config-valorsoft": "^2.2.1", "typedoc": "^0.15.0", - "typescript": "~3.2.4", + "typescript": "3.5.3", "wallaby-webpack": "^3.9.13", "webdriver-manager": "^12.1.0", - "zone.js": "^0.8.26" + "zone.js": "~0.9.1" } } diff --git a/src/package.json b/src/package.json index 0816a04..8a86df8 100644 --- a/src/package.json +++ b/src/package.json @@ -9,20 +9,20 @@ }, "devDependencies": { "@angular/common": "^7.0.3", + "@angular/compiler": "^7.0.3", + "@angular/compiler-cli": "^7.0.3", "@angular/core": "^7.0.3", "@angular/forms": "^7.0.3", "@angular/platform-browser": "^7.0.3", - "zone.js": "^0.8.26", - "rxjs": "^6.5.2", - "@angular/compiler": "^7.0.3", - "@angular/compiler-cli": "^7.0.3", "gulp": "~4.0.0", "gulp-inline-ng2-template": "^5.0.1", + "ng-packagr": "^4.4.0", "rollup": "^0.67.0", - "typescript": "~3.2.4", + "rxjs": "^6.5.2", + "tsickle": "^0.33.1", + "typescript": "3.5.3", "uglify-js": "^3.4.9", - "ng-packagr": "^4.4.0", - "tsickle": "^0.33.1" + "zone.js": "^0.8.26" }, "scripts": { "templates": "gulp inline-templates", diff --git a/tsconfig.json b/tsconfig.json index 3daa3e8..141895a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,12 +1,13 @@ { "compileOnSave": false, "compilerOptions": { + "downlevelIteration": true, "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, - "target": "es5", + "target": "es2015", "typeRoots": [ "node_modules/@types" ], @@ -14,7 +15,7 @@ "es2017", "dom" ], - "module": "es2015", + "module": "esnext", "baseUrl": "./" }, "include": [ From 0f2996dc5f11ebe89fa614d9f5fa00aa4cf53a85 Mon Sep 17 00:00:00 2001 From: Fabio Bottan Date: Sun, 15 Sep 2019 16:02:38 +0100 Subject: [PATCH 03/17] Step 2 upgrade Angular8 (demo offline bot app) --- demo/offline_bot/package.json | 29 ++++++++++++------------- demo/offline_bot/src/tsconfig.app.json | 1 - demo/offline_bot/src/tsconfig.spec.json | 2 -- demo/offline_bot/tsconfig.json | 5 +++-- demo/offline_bot/tslint.json | 8 +++---- 5 files changed, 21 insertions(+), 24 deletions(-) diff --git a/demo/offline_bot/package.json b/demo/offline_bot/package.json index 67995c9..beb0581 100644 --- a/demo/offline_bot/package.json +++ b/demo/offline_bot/package.json @@ -12,29 +12,28 @@ }, "private": true, "dependencies": { - "@angular/animations": "^7.0.3", - "@angular/common": "^7.0.3", - "@angular/compiler": "^7.0.3", - "@angular/core": "^7.0.3", - "@angular/forms": "^7.0.3", - "@angular/http": "^7.0.3", - "@angular/platform-browser": "^7.0.3", - "@angular/platform-browser-dynamic": "^7.0.3", - "@angular/router": "^7.0.3", + "@angular/animations": "^8.2.6", + "@angular/common": "^8.2.6", + "@angular/compiler": "^8.2.6", + "@angular/core": "^8.2.6", + "@angular/forms": "^8.2.6", + "@angular/platform-browser": "^8.2.6", + "@angular/platform-browser-dynamic": "^8.2.6", + "@angular/router": "^8.2.6", "core-js": "^2.5.7", "ng-chat": "^2.0.5", "rxjs": "^6.5.2", - "zone.js": "^0.8.26" + "zone.js": "~0.9.1" }, "devDependencies": { - "@angular-devkit/build-angular": "0.13.4", - "@angular/cli": "^7.0.4", - "@angular/compiler-cli": "^7.0.3", - "@angular/language-service": "^7.0.3", + "@angular-devkit/build-angular": "~0.803.4", + "@angular/cli": "^8.3.4", + "@angular/compiler-cli": "8.2.6", + "@angular/language-service": "^8.2.6", "@types/jasmine": "~2.8.11", "@types/jasminewd2": "~2.0.6", "@types/node": "~10.12.3", - "codelyzer": "~4.5.0", + "codelyzer": "^5.0.1", "jasmine-core": "~3.3.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~3.1.1", diff --git a/demo/offline_bot/src/tsconfig.app.json b/demo/offline_bot/src/tsconfig.app.json index 39ba8db..9231c6e 100644 --- a/demo/offline_bot/src/tsconfig.app.json +++ b/demo/offline_bot/src/tsconfig.app.json @@ -3,7 +3,6 @@ "compilerOptions": { "outDir": "../out-tsc/app", "baseUrl": "./", - "module": "es2015", "types": [] }, "exclude": [ diff --git a/demo/offline_bot/src/tsconfig.spec.json b/demo/offline_bot/src/tsconfig.spec.json index 18bad40..c89454b 100644 --- a/demo/offline_bot/src/tsconfig.spec.json +++ b/demo/offline_bot/src/tsconfig.spec.json @@ -3,8 +3,6 @@ "compilerOptions": { "outDir": "../out-tsc/spec", "baseUrl": "./", - "module": "commonjs", - "target": "es5", "types": [ "jasmine", "node" diff --git a/demo/offline_bot/tsconfig.json b/demo/offline_bot/tsconfig.json index 03efad3..60b960e 100644 --- a/demo/offline_bot/tsconfig.json +++ b/demo/offline_bot/tsconfig.json @@ -1,13 +1,14 @@ { "compileOnSave": false, "compilerOptions": { + "downlevelIteration": true, "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, - "target": "es5", + "target": "es2015", "typeRoots": [ "node_modules/@types" ], @@ -15,7 +16,7 @@ "es2017", "dom" ], - "module": "es2015", + "module": "esnext", "baseUrl": "./" }, "include": [ diff --git a/demo/offline_bot/tslint.json b/demo/offline_bot/tslint.json index 7223e1a..f22f9e8 100644 --- a/demo/offline_bot/tslint.json +++ b/demo/offline_bot/tslint.json @@ -125,12 +125,12 @@ "app", "kebab-case" ], - "use-input-property-decorator": true, - "use-output-property-decorator": true, - "use-host-property-decorator": true, + "no-inputs-metadata-property": true, + "no-outputs-metadata-property": true, + "no-host-metadata-property": true, "no-input-rename": true, "no-output-rename": true, - "use-life-cycle-interface": true, + "use-lifecycle-interface": true, "use-pipe-transform-interface": true, "component-class-suffix": true, "directive-class-suffix": true, From e2e27c78a88db0de1ecd6d02771d731945a1f486 Mon Sep 17 00:00:00 2001 From: Fabio Bottan Date: Wed, 18 Sep 2019 21:40:45 +0100 Subject: [PATCH 04/17] Set typescript version to 3.4.5 --- demo/offline_bot/package.json | 2 +- package.json | 2 +- src/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demo/offline_bot/package.json b/demo/offline_bot/package.json index beb0581..027c8cb 100644 --- a/demo/offline_bot/package.json +++ b/demo/offline_bot/package.json @@ -45,6 +45,6 @@ "protractor": "~5.4.1", "ts-node": "~7.0.1", "tslint": "~5.11.0", - "typescript": "~3.5.3" + "typescript": "3.4.5" } } diff --git a/package.json b/package.json index 0b11919..b90d460 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "tslint": "^5.11.0", "tslint-config-valorsoft": "^2.2.1", "typedoc": "^0.15.0", - "typescript": "3.5.3", + "typescript": "3.4.5", "wallaby-webpack": "^3.9.13", "webdriver-manager": "^12.1.0", "zone.js": "~0.9.1" diff --git a/src/package.json b/src/package.json index 8a86df8..1adc28f 100644 --- a/src/package.json +++ b/src/package.json @@ -20,7 +20,7 @@ "rollup": "^0.67.0", "rxjs": "^6.5.2", "tsickle": "^0.33.1", - "typescript": "3.5.3", + "typescript": "3.4.5", "uglify-js": "^3.4.9", "zone.js": "^0.8.26" }, From 1fb62f67f2880479dc2fdbb7f714ce3ce6fc2585 Mon Sep 17 00:00:00 2001 From: Fabio Bottan Date: Thu, 19 Sep 2019 18:06:14 +0100 Subject: [PATCH 05/17] Step 3 Angular 8 upgrade --- package.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index b90d460..633d568 100644 --- a/package.json +++ b/package.json @@ -28,17 +28,17 @@ }, "dependencies": {}, "devDependencies": { - "@angular-devkit/build-angular": "~0.803.4", - "@angular/cli": "^8.3.4", - "@angular/common": "^8.2.6", - "@angular/compiler": "^8.2.6", - "@angular/compiler-cli": "^8.2.6", - "@angular/core": "^8.2.6", - "@angular/forms": "^8.2.6", - "@angular/language-service": "^8.2.6", - "@angular/platform-browser": "^8.2.6", - "@angular/platform-browser-dynamic": "^8.2.6", - "@angular/router": "^8.2.6", + "@angular-devkit/build-angular": "~0.803.5", + "@angular/cli": "^8.3.5", + "@angular/common": "^8.2.7", + "@angular/compiler": "^8.2.7", + "@angular/compiler-cli": "^8.2.7", + "@angular/core": "^8.2.7", + "@angular/forms": "^8.2.7", + "@angular/language-service": "^8.2.7", + "@angular/platform-browser": "^8.2.7", + "@angular/platform-browser-dynamic": "^8.2.7", + "@angular/router": "^8.2.7", "@angular/tsc-wrapped": "^4.4.6", "@types/jasmine": "^2.8.11", "@types/marked": "^0.4.2", From 2212f192a00605b752c75d43a0ded12b0da8d24f Mon Sep 17 00:00:00 2001 From: Fabio Bottan Date: Thu, 19 Sep 2019 18:53:07 +0100 Subject: [PATCH 06/17] Step 4 Angular 8 upgrade dev dependencies --- src/package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/package.json b/src/package.json index 1adc28f..cad5986 100644 --- a/src/package.json +++ b/src/package.json @@ -8,12 +8,12 @@ "rxjs": "*" }, "devDependencies": { - "@angular/common": "^7.0.3", - "@angular/compiler": "^7.0.3", - "@angular/compiler-cli": "^7.0.3", - "@angular/core": "^7.0.3", - "@angular/forms": "^7.0.3", - "@angular/platform-browser": "^7.0.3", + "@angular/common": "^8.2.7", + "@angular/compiler": "^8.2.7", + "@angular/compiler-cli": "^8.2.7", + "@angular/core": "^8.2.7", + "@angular/forms": "^8.2.7", + "@angular/platform-browser": "^8.2.7", "gulp": "~4.0.0", "gulp-inline-ng2-template": "^5.0.1", "ng-packagr": "^4.4.0", From 565af1de96a1ac424d3ade84f148f11d84c3ae30 Mon Sep 17 00:00:00 2001 From: Fabio Bottan Date: Thu, 19 Sep 2019 19:04:00 +0100 Subject: [PATCH 07/17] Update karma jasmine --- demo/offline_bot/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/offline_bot/package.json b/demo/offline_bot/package.json index 027c8cb..ad2373f 100644 --- a/demo/offline_bot/package.json +++ b/demo/offline_bot/package.json @@ -41,7 +41,7 @@ "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^2.0.4", "karma-jasmine": "~1.1.2", - "karma-jasmine-html-reporter": "^1.4.0", + "karma-jasmine-html-reporter": "^1.4.2", "protractor": "~5.4.1", "ts-node": "~7.0.1", "tslint": "~5.11.0", From c9af4c3ea4338be4fa2e1040025a18b0ce685abd Mon Sep 17 00:00:00 2001 From: Fabio Bottan Date: Fri, 27 Sep 2019 10:56:41 +0100 Subject: [PATCH 08/17] Update package.json Update Karma Jasmine testing libs --- package.json | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 633d568..b223d49 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,8 @@ "@angular/platform-browser-dynamic": "^8.2.7", "@angular/router": "^8.2.7", "@angular/tsc-wrapped": "^4.4.6", - "@types/jasmine": "^2.8.11", + "@types/jasmine": "^3.3.8", + "@types/jasminewd2": "2.0.3", "@types/marked": "^0.4.2", "@types/node": "^10.12.4", "@types/webpack": "^4.4.18", @@ -55,15 +56,15 @@ "cpy-cli": "^2.0.0", "del-cli": "^1.1.0", "html-loader": "^0.5.5", - "jasmine": "^3.3.0", - "jasmine-core": "^3.3.0", + "jasmine": "^3.4.0", + "jasmine-core": "^3.4.0", "jasmine-data-provider": "^2.2.0", "jasmine-spec-reporter": "^4.2.1", - "karma": "^3.1.1", + "karma": "4.1.0", "karma-chrome-launcher": "^2.2.0", "karma-cli": "^1.0.1", "karma-coverage-istanbul-reporter": "^2.0.4", - "karma-jasmine": "^1.1.2", + "karma-jasmine": "2.0.1", "karma-remap-istanbul": "^0.6.0", "karma-sauce-launcher": "^1.2.0", "lite-server": "^2.4.0", @@ -74,11 +75,11 @@ "protractor": "^5.4.1", "reflect-metadata": "^0.1.12", "require-dir": "^1.1.0", - "rxjs": "^6.3.3", + "rxjs": "^6.4.0", "systemjs-builder": "^0.16.13", "ts-helpers": "^1.1.2", "ts-node": "^7.0.1", - "tslint": "^5.11.0", + "tslint": "^5.15.0", "tslint-config-valorsoft": "^2.2.1", "typedoc": "^0.15.0", "typescript": "3.4.5", From 1ca624d61863c9fb059cb9cf4a2326450df2d192 Mon Sep 17 00:00:00 2001 From: Fabio Bottan Date: Fri, 27 Sep 2019 10:59:20 +0100 Subject: [PATCH 09/17] Update package.json Update karma jasmine testing libs --- demo/offline_bot/package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/demo/offline_bot/package.json b/demo/offline_bot/package.json index ad2373f..bb1dae8 100644 --- a/demo/offline_bot/package.json +++ b/demo/offline_bot/package.json @@ -30,21 +30,21 @@ "@angular/cli": "^8.3.4", "@angular/compiler-cli": "8.2.6", "@angular/language-service": "^8.2.6", - "@types/jasmine": "~2.8.11", + "@types/jasmine": "~3.3.8", "@types/jasminewd2": "~2.0.6", "@types/node": "~10.12.3", "codelyzer": "^5.0.1", - "jasmine-core": "~3.3.0", + "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", - "karma": "~3.1.1", + "karma": "~4.1.0", "karma-chrome-launcher": "~2.2.0", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^2.0.4", - "karma-jasmine": "~1.1.2", + "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.2", "protractor": "~5.4.1", "ts-node": "~7.0.1", - "tslint": "~5.11.0", + "tslint": "~5.15.0", "typescript": "3.4.5" } } From 54911e84a0a7d91c7da6d8e5b72bc036947a69c0 Mon Sep 17 00:00:00 2001 From: Rafael Carvalho Date: Thu, 16 Apr 2020 17:04:15 +1200 Subject: [PATCH 10/17] Upgrade test environment to Angular 9 --- angular.json | 115 ++++++++++++++------------- karma.conf.js | 31 +++----- package.json | 121 ++++++++++------------------- src/polyfills.ts | 63 +++++++++++++++ src/spec/ng-chat.component.spec.ts | 8 +- src/test.ts | 25 ++++++ test.ts | 26 +++---- tsconfig.json | 30 +++---- tsconfig.spec.json | 18 +++++ 9 files changed, 247 insertions(+), 190 deletions(-) create mode 100644 src/polyfills.ts create mode 100644 src/test.ts create mode 100644 tsconfig.spec.json diff --git a/angular.json b/angular.json index 4e5fa81..fb7c5f5 100644 --- a/angular.json +++ b/angular.json @@ -3,39 +3,61 @@ "version": 1, "newProjectRoot": "projects", "projects": { - "ng-chat": { - "root": "demo/offline_bot", - "sourceRoot": "demo/offline_bot/src", + "my-app-angular-test": { "projectType": "application", + "schematics": { + "@schematics/angular:component": { + "style": "scss" + } + }, + "root": "", + "sourceRoot": "src", + "prefix": "app", "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "demo/offline_bot/dist", - "index": "demo/offline_bot/src/index.html", - "main": "demo/offline_bot/src/main.ts", - "tsConfig": "demo/offline_bot/src/../../../tsconfig.json", + "outputPath": "dist/my-app-angular-test", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.app.json", + "aot": true, "assets": [ - "demo/offline_bot/src/assets" + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.scss" ], - "styles": [], "scripts": [] }, "configurations": { "production": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ], "optimization": true, "outputHashing": "all", "sourceMap": false, "extractCss": true, "namedChunks": false, - "aot": true, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, - "fileReplacements": [ + "budgets": [ { - "replace": "demo/offline_bot/src/environments/environment.ts", - "with": "demo/offline_bot/src/environments/environment.prod.ts" + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" } ] } @@ -44,72 +66,61 @@ "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { - "browserTarget": "ng-chat:build" + "browserTarget": "my-app-angular-test:build" }, "configurations": { "production": { - "browserTarget": "ng-chat:build:production" + "browserTarget": "my-app-angular-test:build:production" } } }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "ng-chat:build" + "browserTarget": "my-app-angular-test:build" } }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "main": "demo/offline_bot/src/../../../test.ts", + "main": "src/test.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.spec.json", "karmaConfig": "karma.conf.js", - "scripts": [], - "styles": [], "assets": [ - "demo/offline_bot/src/assets" + "src/favicon.ico", + "src/assets" ], - "tsConfig": "demo/offline_bot/src/../../../tsconfig.json" + "styles": [], + "scripts": [] } }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { - "tsConfig": [], - "exclude": [] + "tsConfig": [ + "tsconfig.app.json", + "tsconfig.spec.json", + "e2e/tsconfig.json" + ], + "exclude": [ + "**/node_modules/**" + ] } - } - } - }, - "ng-chat-e2e": { - "root": "demo/offline_bot/e2e", - "sourceRoot": "demo/offline_bot/e2e", - "projectType": "application", - "architect": { + }, "e2e": { "builder": "@angular-devkit/build-angular:protractor", "options": { - "protractorConfig": "protractor.conf.js", - "devServerTarget": "ng-chat:serve" - } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [], - "exclude": [] + "protractorConfig": "e2e/protractor.conf.js", + "devServerTarget": "my-app-angular-test:serve" + }, + "configurations": { + "production": { + "devServerTarget": "my-app-angular-test:serve:production" + } } } } - } - }, - "defaultProject": "ng-chat", - "schematics": { - "@schematics/angular:component": { - "prefix": "", - "styleext": "css" - }, - "@schematics/angular:directive": { - "prefix": "" - } - } + }}, + "defaultProject": "my-app-angular-test" } diff --git a/karma.conf.js b/karma.conf.js index 1367d5c..0b997c1 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,39 +1,32 @@ // Karma configuration file, see link for more information -// https://karma-runner.github.io/0.13/config/configuration-file.html +// https://karma-runner.github.io/1.0/config/configuration-file.html module.exports = function (config) { - const configuration = { + config.set({ basePath: '', frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), require('karma-coverage-istanbul-reporter'), require('@angular-devkit/build-angular/plugins/karma') ], - // files: [ - // {pattern: './test.ts', watched: false} - // ], - // preprocessors: { - // './test.ts': ['@angular-devkit/build-angular'] - // }, + client: { + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, coverageIstanbulReporter: { - dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ], - fixWebpackSourcePaths: false + dir: require('path').join(__dirname, './coverage/my-app-angular-test'), + reports: ['html', 'lcovonly', 'text-summary'], + fixWebpackSourcePaths: true }, - - reporters: config.angularCli && config.angularCli.codeCoverage - ? ['dots', 'coverage-istanbul'] - : ['dots'], + reporters: ['progress', 'kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false, - mime: { 'text/x-typescript': ['ts','tsx'] }, - client: { captureConsole: true } - }; - - config.set(configuration); + restartOnFileChange: true + }); }; diff --git a/package.json b/package.json index b223d49..468e3a9 100644 --- a/package.json +++ b/package.json @@ -1,90 +1,47 @@ { - "name": "ng-chat-base", + "name": "my-app-angular-test", "version": "0.0.0", - "private": true, - "description": "ng-chat test base package", "scripts": { - "link": "ngm link -p src --here", - "lint": "exit 0", - "start": "ng serve --aot", - "pretest": "run-s lint build link", - "test": "ng test -sr", - "test-coverage": "ng test -sr -cc", - "version": "npm run flow.changelog && git add -A" + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "test": "ng test", + "lint": "ng lint", + "e2e": "ng e2e" }, - "main": "bundles/ng-chat.umd.js", - "module": "index.js", - "typings": "index.d.ts", - "keywords": [ - "angular2", - "angular", - "ng-chat" - ], - "author": "Rafael Carvalho", - "license": "MIT", - "homepage": "https://github.com/rpaschoal/ng-chat", - "bugs": { - "url": "https://github.com/rpaschoal/ng-chat/issues" + "private": true, + "dependencies": { + "@angular/animations": "~9.1.1", + "@angular/common": "~9.1.1", + "@angular/compiler": "~9.1.1", + "@angular/core": "~9.1.1", + "@angular/forms": "~9.1.1", + "@angular/platform-browser": "~9.1.1", + "@angular/platform-browser-dynamic": "~9.1.1", + "@angular/router": "~9.1.1", + "rxjs": "~6.5.4", + "tslib": "^1.10.0", + "zone.js": "~0.10.2" }, - "dependencies": {}, "devDependencies": { - "@angular-devkit/build-angular": "~0.803.5", - "@angular/cli": "^8.3.5", - "@angular/common": "^8.2.7", - "@angular/compiler": "^8.2.7", - "@angular/compiler-cli": "^8.2.7", - "@angular/core": "^8.2.7", - "@angular/forms": "^8.2.7", - "@angular/language-service": "^8.2.7", - "@angular/platform-browser": "^8.2.7", - "@angular/platform-browser-dynamic": "^8.2.7", - "@angular/router": "^8.2.7", - "@angular/tsc-wrapped": "^4.4.6", - "@types/jasmine": "^3.3.8", - "@types/jasminewd2": "2.0.3", - "@types/marked": "^0.4.2", - "@types/node": "^10.12.4", - "@types/webpack": "^4.4.18", - "chokidar-cli": "^1.2.1", - "classlist-polyfill": "^1.2.0", - "codecov": "^3.1.0", - "codelyzer": "^5.0.1", - "conventional-changelog-cli": "^2.0.11", - "conventional-github-releaser": "^3.1.2", - "core-js": "^2.5.7", - "cpy": "^7.0.1", - "cpy-cli": "^2.0.0", - "del-cli": "^1.1.0", - "html-loader": "^0.5.5", - "jasmine": "^3.4.0", - "jasmine-core": "^3.4.0", - "jasmine-data-provider": "^2.2.0", - "jasmine-spec-reporter": "^4.2.1", - "karma": "4.1.0", - "karma-chrome-launcher": "^2.2.0", - "karma-cli": "^1.0.1", - "karma-coverage-istanbul-reporter": "^2.0.4", - "karma-jasmine": "2.0.1", - "karma-remap-istanbul": "^0.6.0", - "karma-sauce-launcher": "^1.2.0", - "lite-server": "^2.4.0", - "lodash": "^4.17.11", - "ngm-cli": "^1.0.4", - "npm-run-all": "^4.1.3", - "pre-commit": "^1.2.2", - "protractor": "^5.4.1", - "reflect-metadata": "^0.1.12", - "require-dir": "^1.1.0", - "rxjs": "^6.4.0", - "systemjs-builder": "^0.16.13", - "ts-helpers": "^1.1.2", - "ts-node": "^7.0.1", - "tslint": "^5.15.0", - "tslint-config-valorsoft": "^2.2.1", - "typedoc": "^0.15.0", - "typescript": "3.4.5", - "wallaby-webpack": "^3.9.13", - "webdriver-manager": "^12.1.0", - "zone.js": "~0.9.1" + "@angular-devkit/build-angular": "~0.901.1", + "@angular/cli": "~9.1.1", + "@angular/compiler-cli": "~9.1.1", + "@angular/language-service": "~9.1.1", + "@types/node": "^12.11.1", + "@types/jasmine": "~3.5.0", + "@types/jasminewd2": "~2.0.3", + "codelyzer": "^5.1.2", + "jasmine-core": "~3.5.0", + "jasmine-spec-reporter": "~4.2.1", + "karma": "~4.4.1", + "karma-chrome-launcher": "~3.1.0", + "karma-coverage-istanbul-reporter": "~2.1.0", + "karma-jasmine": "~3.0.1", + "karma-jasmine-html-reporter": "^1.4.2", + "protractor": "~5.4.3", + "ts-node": "~8.3.0", + "tslint": "~6.1.0", + "typescript": "~3.8.3" } } diff --git a/src/polyfills.ts b/src/polyfills.ts new file mode 100644 index 0000000..03711e5 --- /dev/null +++ b/src/polyfills.ts @@ -0,0 +1,63 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/guide/browser-support + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + */ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + * because those flags need to be set before `zone.js` being loaded, and webpack + * will put import in the top of bundle, so user need to create a separate file + * in this directory (for example: zone-flags.ts), and put the following flags + * into that file, and then add the following code before importing zone.js. + * import './zone-flags'; + * + * The flags allowed in zone-flags.ts are listed here. + * + * The following flags will work for all browsers. + * + * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + * + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + * + * (window as any).__Zone_enable_cross_context_check = true; + * + */ + +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/src/spec/ng-chat.component.spec.ts b/src/spec/ng-chat.component.spec.ts index d3c5bc4..ffb2487 100644 --- a/src/spec/ng-chat.component.spec.ts +++ b/src/spec/ng-chat.component.spec.ts @@ -893,7 +893,9 @@ describe('NgChat', () => { spyOn(fakeChatInputs[1].nativeElement, 'focus'); spyOn(subject.chatWindowInputs, 'toArray').and.returnValue(fakeChatInputs); + // @ts-ignore spyOn(window, 'setTimeout').and.callFake((fn) => { + // @ts-ignore fn(); }); @@ -956,6 +958,8 @@ describe('NgChat', () => { it('Must bootstrap browser notifications when user permission is granted', async () => { subject.browserNotificationsBootstrapped = false; + + // @ts-ignore spyOn(Notification, 'requestPermission').and.returnValue(true); await subject.initializeBrowserNotifications(); @@ -966,6 +970,8 @@ describe('NgChat', () => { it('Must not bootstrap browser notifications when user permission is not granted', async () => { subject.browserNotificationsBootstrapped = false; + + // @ts-ignore spyOn(Notification, 'requestPermission').and.returnValue(false); await subject.initializeBrowserNotifications(); @@ -1173,7 +1179,6 @@ describe('NgChat', () => { spyOn(subject, 'updateWindowsState'); spyOn(subject, 'focusOnWindow'); - spyOn(subject, 'onParticipantChatOpened'); subject.openChatWindow(newUser, false, true); @@ -1220,7 +1225,6 @@ describe('NgChat', () => { spyOn(subject, 'updateWindowsState'); spyOn(subject, 'focusOnWindow'); - spyOn(subject, 'onParticipantChatOpened'); subject.openChatWindow(newUser, false, true); diff --git a/src/test.ts b/src/test.ts new file mode 100644 index 0000000..50193eb --- /dev/null +++ b/src/test.ts @@ -0,0 +1,25 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/dist/zone-testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: { + context(path: string, deep?: boolean, filter?: RegExp): { + keys(): string[]; + (id: string): T; + }; +}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() +); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); diff --git a/test.ts b/test.ts index 28225ac..50193eb 100644 --- a/test.ts +++ b/test.ts @@ -1,23 +1,18 @@ -import './demo/offline_bot/src/polyfills.ts'; +// This file is required by karma.conf.js and loads recursively all the .spec and framework files -import 'zone.js/dist/long-stack-trace-zone'; -import 'zone.js/dist/proxy.js'; -import 'zone.js/dist/sync-test'; -import 'zone.js/dist/jasmine-patch'; -import 'zone.js/dist/async-test'; -import 'zone.js/dist/fake-async-test'; +import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; -// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. -declare var __karma__: any; -declare var require: any; - -// Prevent Karma from running prematurely. -__karma__.loaded = Function.prototype; +declare const require: { + context(path: string, deep?: boolean, filter?: RegExp): { + keys(): string[]; + (id: string): T; + }; +}; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( @@ -25,9 +20,6 @@ getTestBed().initTestEnvironment( platformBrowserDynamicTesting() ); // Then we find all the tests. -let context = require.context('./src/spec', true, /\.spec\.ts/); +const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. context.keys().map(context); - -// Finally, start Karma to run the tests. -__karma__.start(); diff --git a/tsconfig.json b/tsconfig.json index 141895a..8c4ef3b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,29 +1,23 @@ { "compileOnSave": false, "compilerOptions": { - "downlevelIteration": true, + "baseUrl": "./", + "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, - "moduleResolution": "node", - "emitDecoratorMetadata": true, + "downlevelIteration": true, "experimentalDecorators": true, + "module": "esnext", + "moduleResolution": "node", + "importHelpers": true, "target": "es2015", - "typeRoots": [ - "node_modules/@types" - ], "lib": [ - "es2017", + "es2018", "dom" - ], - "module": "esnext", - "baseUrl": "./" + ] }, - "include": [ - "demo/offline_bot/src/**/*", - "demo/offline_bot/node_modules/ng-chat/**/*", - "src/spec/**/*" - ], - "files": [ - "test.ts" - ] + "angularCompilerOptions": { + "fullTemplateTypeCheck": true, + "strictInjectionParameters": true + } } diff --git a/tsconfig.spec.json b/tsconfig.spec.json new file mode 100644 index 0000000..6400fde --- /dev/null +++ b/tsconfig.spec.json @@ -0,0 +1,18 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/spec", + "types": [ + "jasmine", + "node" + ] + }, + "files": [ + "src/test.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} From f82b4711a7c443c08462ec7945d591e0bb8014fb Mon Sep 17 00:00:00 2001 From: Rafael Carvalho Date: Thu, 16 Apr 2020 18:45:38 +1200 Subject: [PATCH 11/17] Upgrade demo project to Angular 9 --- demo/offline_bot/angular.json | 9 ++++++- demo/offline_bot/package.json | 33 +++++++++++++------------- demo/offline_bot/src/tsconfig.app.json | 9 ++++--- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/demo/offline_bot/angular.json b/demo/offline_bot/angular.json index 4fe156c..d28cad3 100644 --- a/demo/offline_bot/angular.json +++ b/demo/offline_bot/angular.json @@ -11,6 +11,7 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { + "aot": true, "preserveSymlinks": true, "outputPath": "dist", "index": "src/index.html", @@ -28,6 +29,12 @@ }, "configurations": { "production": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ], "optimization": true, "outputHashing": "all", "sourceMap": false, @@ -124,7 +131,7 @@ "schematics": { "@schematics/angular:component": { "prefix": "app", - "styleext": "css" + "style": "css" }, "@schematics/angular:directive": { "prefix": "app" diff --git a/demo/offline_bot/package.json b/demo/offline_bot/package.json index bb1dae8..c0aeead 100644 --- a/demo/offline_bot/package.json +++ b/demo/offline_bot/package.json @@ -12,28 +12,29 @@ }, "private": true, "dependencies": { - "@angular/animations": "^8.2.6", - "@angular/common": "^8.2.6", - "@angular/compiler": "^8.2.6", - "@angular/core": "^8.2.6", - "@angular/forms": "^8.2.6", - "@angular/platform-browser": "^8.2.6", - "@angular/platform-browser-dynamic": "^8.2.6", - "@angular/router": "^8.2.6", + "@angular/animations": "^9.1.2", + "@angular/common": "^9.1.2", + "@angular/compiler": "^9.1.2", + "@angular/core": "^9.1.2", + "@angular/forms": "^9.1.2", + "@angular/platform-browser": "^9.1.2", + "@angular/platform-browser-dynamic": "^9.1.2", + "@angular/router": "^9.1.2", "core-js": "^2.5.7", "ng-chat": "^2.0.5", "rxjs": "^6.5.2", - "zone.js": "~0.9.1" + "tslib": "^1.10.0", + "zone.js": "~0.10.2" }, "devDependencies": { - "@angular-devkit/build-angular": "~0.803.4", - "@angular/cli": "^8.3.4", - "@angular/compiler-cli": "8.2.6", - "@angular/language-service": "^8.2.6", + "@angular-devkit/build-angular": "~0.901.1", + "@angular/cli": "^9.1.1", + "@angular/compiler-cli": "9.1.2", + "@angular/language-service": "^9.1.2", "@types/jasmine": "~3.3.8", "@types/jasminewd2": "~2.0.6", - "@types/node": "~10.12.3", - "codelyzer": "^5.0.1", + "@types/node": "^12.11.1", + "codelyzer": "^5.1.2", "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.1.0", @@ -45,6 +46,6 @@ "protractor": "~5.4.1", "ts-node": "~7.0.1", "tslint": "~5.15.0", - "typescript": "3.4.5" + "typescript": "3.8.3" } } diff --git a/demo/offline_bot/src/tsconfig.app.json b/demo/offline_bot/src/tsconfig.app.json index 9231c6e..2e7a5b2 100644 --- a/demo/offline_bot/src/tsconfig.app.json +++ b/demo/offline_bot/src/tsconfig.app.json @@ -5,8 +5,11 @@ "baseUrl": "./", "types": [] }, - "exclude": [ - "test.ts", - "**/*.spec.ts" + "files": [ + "main.ts", + "polyfills.ts" + ], + "include": [ + "src/**/*.d.ts" ] } From 9220816e8d446e44f062e8aac28b05cd2970bfc1 Mon Sep 17 00:00:00 2001 From: Rafael Carvalho Date: Thu, 16 Apr 2020 18:52:17 +1200 Subject: [PATCH 12/17] Upgrade ng-chat source to Angular 9 --- demo/offline_bot/src/tsconfig.app.json | 4 +++- src/package.json | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/demo/offline_bot/src/tsconfig.app.json b/demo/offline_bot/src/tsconfig.app.json index 2e7a5b2..f207a00 100644 --- a/demo/offline_bot/src/tsconfig.app.json +++ b/demo/offline_bot/src/tsconfig.app.json @@ -10,6 +10,8 @@ "polyfills.ts" ], "include": [ - "src/**/*.d.ts" + "src/**/*.d.ts", + "../node_modules/ng-chat/*.ts", + "../node_modules/ng-chat/ng-chat/**/*.ts" ] } diff --git a/src/package.json b/src/package.json index cad5986..17d575d 100644 --- a/src/package.json +++ b/src/package.json @@ -8,12 +8,12 @@ "rxjs": "*" }, "devDependencies": { - "@angular/common": "^8.2.7", - "@angular/compiler": "^8.2.7", - "@angular/compiler-cli": "^8.2.7", - "@angular/core": "^8.2.7", - "@angular/forms": "^8.2.7", - "@angular/platform-browser": "^8.2.7", + "@angular/common": "^9.1.2", + "@angular/compiler": "^9.1.2", + "@angular/compiler-cli": "^9.1.2", + "@angular/core": "^9.1.2", + "@angular/forms": "^9.1.2", + "@angular/platform-browser": "^9.1.2", "gulp": "~4.0.0", "gulp-inline-ng2-template": "^5.0.1", "ng-packagr": "^4.4.0", From e9df7a8dad20e1408ed2dcdb17a6fea1c855b995 Mon Sep 17 00:00:00 2001 From: Rafael Carvalho Date: Thu, 16 Apr 2020 19:00:18 +1200 Subject: [PATCH 13/17] Bump packages on offline demo project --- demo/offline_bot/package.json | 38 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/demo/offline_bot/package.json b/demo/offline_bot/package.json index c0aeead..8536ee9 100644 --- a/demo/offline_bot/package.json +++ b/demo/offline_bot/package.json @@ -22,30 +22,30 @@ "@angular/router": "^9.1.2", "core-js": "^2.5.7", "ng-chat": "^2.0.5", - "rxjs": "^6.5.2", - "tslib": "^1.10.0", - "zone.js": "~0.10.2" + "rxjs": "^6.5.5", + "tslib": "^1.11.1", + "zone.js": "~0.10.3" }, "devDependencies": { "@angular-devkit/build-angular": "~0.901.1", "@angular/cli": "^9.1.1", "@angular/compiler-cli": "9.1.2", "@angular/language-service": "^9.1.2", - "@types/jasmine": "~3.3.8", - "@types/jasminewd2": "~2.0.6", - "@types/node": "^12.11.1", - "codelyzer": "^5.1.2", - "jasmine-core": "~3.4.0", - "jasmine-spec-reporter": "~4.2.1", - "karma": "~4.1.0", - "karma-chrome-launcher": "~2.2.0", - "karma-cli": "~1.0.1", - "karma-coverage-istanbul-reporter": "^2.0.4", - "karma-jasmine": "~2.0.1", - "karma-jasmine-html-reporter": "^1.4.2", - "protractor": "~5.4.1", - "ts-node": "~7.0.1", - "tslint": "~5.15.0", - "typescript": "3.8.3" + "@types/jasmine": "~3.5.10", + "@types/jasminewd2": "~2.0.8", + "@types/node": "^13.11.1", + "codelyzer": "^5.2.2", + "jasmine-core": "~3.5.0", + "jasmine-spec-reporter": "~5.0.1", + "karma": "~5.0.1", + "karma-chrome-launcher": "~3.1.0", + "karma-cli": "~2.0.0", + "karma-coverage-istanbul-reporter": "^2.1.1", + "karma-jasmine": "~3.1.1", + "karma-jasmine-html-reporter": "^1.5.3", + "protractor": "~5.4.3", + "ts-node": "~8.8.2", + "tslint": "~6.1.1", + "typescript": "~3.8.3" } } From 2fd99676fac08e56ab4a3018419a75e34719c3d4 Mon Sep 17 00:00:00 2001 From: Rafael Carvalho Date: Thu, 16 Apr 2020 19:02:13 +1200 Subject: [PATCH 14/17] Bum packages on ng-chat source --- src/package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/package.json b/src/package.json index 17d575d..d9aa0a5 100644 --- a/src/package.json +++ b/src/package.json @@ -14,15 +14,15 @@ "@angular/core": "^9.1.2", "@angular/forms": "^9.1.2", "@angular/platform-browser": "^9.1.2", - "gulp": "~4.0.0", + "gulp": "~4.0.2", "gulp-inline-ng2-template": "^5.0.1", - "ng-packagr": "^4.4.0", - "rollup": "^0.67.0", - "rxjs": "^6.5.2", - "tsickle": "^0.33.1", - "typescript": "3.4.5", - "uglify-js": "^3.4.9", - "zone.js": "^0.8.26" + "ng-packagr": "^9.1.1", + "rollup": "^2.6.1", + "rxjs": "^6.5.5", + "tsickle": "^0.38.1", + "typescript": "~3.8.3", + "uglify-js": "^3.9.1", + "zone.js": "^0.10.3" }, "scripts": { "templates": "gulp inline-templates", From fbc75cc34483d13a2f2727d8796c1243341de216 Mon Sep 17 00:00:00 2001 From: Rafael Carvalho Date: Thu, 16 Apr 2020 19:05:33 +1200 Subject: [PATCH 15/17] Bump packages on test project --- package.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 468e3a9..181e342 100644 --- a/package.json +++ b/package.json @@ -19,29 +19,29 @@ "@angular/platform-browser": "~9.1.1", "@angular/platform-browser-dynamic": "~9.1.1", "@angular/router": "~9.1.1", - "rxjs": "~6.5.4", - "tslib": "^1.10.0", - "zone.js": "~0.10.2" + "rxjs": "~6.5.5", + "tslib": "^1.11.1", + "zone.js": "~0.10.3" }, "devDependencies": { "@angular-devkit/build-angular": "~0.901.1", "@angular/cli": "~9.1.1", "@angular/compiler-cli": "~9.1.1", "@angular/language-service": "~9.1.1", - "@types/node": "^12.11.1", - "@types/jasmine": "~3.5.0", - "@types/jasminewd2": "~2.0.3", - "codelyzer": "^5.1.2", + "@types/node": "^13.11.1", + "@types/jasmine": "~3.5.10", + "@types/jasminewd2": "~2.0.8", + "codelyzer": "^5.2.2", "jasmine-core": "~3.5.0", - "jasmine-spec-reporter": "~4.2.1", - "karma": "~4.4.1", + "jasmine-spec-reporter": "~5.0.1", + "karma": "~5.0.1", "karma-chrome-launcher": "~3.1.0", - "karma-coverage-istanbul-reporter": "~2.1.0", - "karma-jasmine": "~3.0.1", - "karma-jasmine-html-reporter": "^1.4.2", + "karma-coverage-istanbul-reporter": "~2.1.1", + "karma-jasmine": "~3.1.1", + "karma-jasmine-html-reporter": "^1.5.3", "protractor": "~5.4.3", - "ts-node": "~8.3.0", - "tslint": "~6.1.0", + "ts-node": "~8.8.2", + "tslint": "~6.1.1", "typescript": "~3.8.3" } } From 3210f1bc6c2a3adfd91ab3e41e81df8d193b6362 Mon Sep 17 00:00:00 2001 From: Rafael Carvalho Date: Fri, 17 Apr 2020 11:27:08 +1200 Subject: [PATCH 16/17] Update Notification API check --- src/ng-chat/ng-chat.component.ts | 2 +- src/spec/ng-chat.component.spec.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ng-chat/ng-chat.component.ts b/src/ng-chat/ng-chat.component.ts index 28724a0..6d75ced 100644 --- a/src/ng-chat/ng-chat.component.ts +++ b/src/ng-chat/ng-chat.component.ts @@ -364,7 +364,7 @@ export class NgChat implements OnInit, IChatController { { if (this.browserNotificationsEnabled && ("Notification" in window)) { - if (await Notification.requestPermission()) + if (await Notification.requestPermission() === "granted") { this.browserNotificationsBootstrapped = true; } diff --git a/src/spec/ng-chat.component.spec.ts b/src/spec/ng-chat.component.spec.ts index ffb2487..160f09d 100644 --- a/src/spec/ng-chat.component.spec.ts +++ b/src/spec/ng-chat.component.spec.ts @@ -959,8 +959,7 @@ describe('NgChat', () => { it('Must bootstrap browser notifications when user permission is granted', async () => { subject.browserNotificationsBootstrapped = false; - // @ts-ignore - spyOn(Notification, 'requestPermission').and.returnValue(true); + spyOn(Notification, 'requestPermission').and.returnValue(Promise.resolve("granted")); await subject.initializeBrowserNotifications(); @@ -971,8 +970,7 @@ describe('NgChat', () => { it('Must not bootstrap browser notifications when user permission is not granted', async () => { subject.browserNotificationsBootstrapped = false; - // @ts-ignore - spyOn(Notification, 'requestPermission').and.returnValue(false); + spyOn(Notification, 'requestPermission').and.returnValue(Promise.resolve("denied")); await subject.initializeBrowserNotifications(); From c08002a851427de108f8d7845c14583db0d85031 Mon Sep 17 00:00:00 2001 From: Rafael Carvalho Date: Fri, 17 Apr 2020 11:41:18 +1200 Subject: [PATCH 17/17] Update package version --- demo/offline_bot/package.json | 2 +- src/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/offline_bot/package.json b/demo/offline_bot/package.json index 8536ee9..3de178c 100644 --- a/demo/offline_bot/package.json +++ b/demo/offline_bot/package.json @@ -21,7 +21,7 @@ "@angular/platform-browser-dynamic": "^9.1.2", "@angular/router": "^9.1.2", "core-js": "^2.5.7", - "ng-chat": "^2.0.5", + "ng-chat": "^3.0.0", "rxjs": "^6.5.5", "tslib": "^1.11.1", "zone.js": "~0.10.3" diff --git a/src/package.json b/src/package.json index d9aa0a5..e4b0d8a 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "ng-chat", - "version": "2.0.5", + "version": "3.0.0", "peerDependencies": { "@angular/common": "*", "@angular/core": "*",