Skip to content

Commit

Permalink
Merge pull request #58 from cloudnc/feat/upgrade-angular-typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
zakhenry authored Oct 24, 2020
2 parents 469c0bc + 43d9c12 commit 8253341
Show file tree
Hide file tree
Showing 23 changed files with 4,135 additions and 2,540 deletions.
52 changes: 15 additions & 37 deletions .betterer.results
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
// BETTERER RESULTS V1.
exports[`stricter compilation`] = {
timestamp: 1589991341747,
timestamp: 1603555076420,
value: `{
"projects/observable-webworker/src/lib/from-worker-pool.spec.ts:723302687": [
[94, 8, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[102, 8, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[135, 8, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[141, 8, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[187, 8, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[193, 8, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[258, 10, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[264, 10, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[288, 33, 33, "Argument of type \'(observer: Observer<number>) => () => void\' is not assignable to parameter of type \'(this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic\'.\\n Types of parameters \'observer\' and \'subscriber\' are incompatible.\\n Type \'Subscriber<T>\' is not assignable to type \'Observer<number>\'.\\n Types of property \'next\' are incompatible.\\n Type \'(value?: T | undefined) => void\' is not assignable to type \'(value: number) => void\'.\\n Types of parameters \'value\' and \'value\' are incompatible.\\n Type \'number\' is not assignable to type \'T | undefined\'.", "1166033031"],
[325, 10, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[331, 10, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"]
"projects/observable-webworker/src/lib/from-worker-pool.spec.ts:2815790124": [
[288, 33, 33, "Argument of type \'(observer: Observer<number>) => () => void\' is not assignable to parameter of type \'(this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic\'.\\n Types of parameters \'observer\' and \'subscriber\' are incompatible.\\n Type \'Subscriber<T>\' is not assignable to type \'Observer<number>\'.\\n Types of property \'next\' are incompatible.\\n Type \'(value?: T | undefined) => void\' is not assignable to type \'(value: number) => void\'.\\n Types of parameters \'value\' and \'value\' are incompatible.\\n Type \'number\' is not assignable to type \'T | undefined\'.", "1166033031"]
],
"projects/observable-webworker/src/lib/from-worker.spec.ts:2304322660": [
[9, 6, 16, "Variable \'workerFactorySpy\' implicitly has type \'any\' in some locations where its type cannot be determined.", "4184968637"],
[25, 11, 16, "Variable \'workerFactorySpy\' implicitly has an \'any\' type.", "4184968637"],
[30, 11, 16, "Variable \'workerFactorySpy\' implicitly has an \'any\' type.", "4184968637"],
[75, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[83, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[98, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[114, 4, 18, "Cannot invoke an object which is possibly \'null\'.", "3118492308"],
[148, 11, 16, "Variable \'workerFactorySpy\' implicitly has an \'any\' type.", "4184968637"],
[167, 65, 16, "Variable \'workerFactorySpy\' implicitly has an \'any\' type.", "4184968637"],
[178, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[184, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"]
"projects/observable-webworker/src/lib/from-worker.spec.ts:2047567224": [
[92, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[171, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
[177, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"]
],
"projects/observable-webworker/src/lib/from-worker.ts:4009652202": [
[28, 56, 11, "Argument of type \'Input | undefined\' is not assignable to parameter of type \'Input\'.\\n Type \'undefined\' is not assignable to type \'Input\'.", "1574273654"]
[28, 56, 11, "Argument of type \'Input | undefined\' is not assignable to parameter of type \'Input\'.\\n \'Input\' could be instantiated with an arbitrary type which could be unrelated to \'Input | undefined\'.\\n Type \'undefined\' is not assignable to type \'Input\'.\\n \'Input\' could be instantiated with an arbitrary type which could be unrelated to \'undefined\'.", "1574273654"]
],
"projects/observable-webworker/src/lib/run-worker.spec.ts:4277544177": [
"projects/observable-webworker/src/lib/run-worker.spec.ts:1321560577": [
[19, 8, 17, "Type \'undefined\' is not assignable to type \'Observable<number>\'.", "4204377774"],
[25, 8, 17, "Type \'undefined\' is not assignable to type \'Observable<number>\'.", "4204377774"],
[38, 8, 17, "Type \'undefined\' is not assignable to type \'Observable<number>\'.", "4204377774"],
Expand All @@ -40,7 +22,7 @@ exports[`stricter compilation`] = {
"projects/observable-webworker/src/lib/run-worker.ts:1913596105": [
[4, 65, 7, "Rest parameter \'args\' implicitly has an \'any[]\' type.", "3622679692"],
[51, 38, 26, "Cannot invoke an object which is possibly \'undefined\'.", "4028913799"],
[51, 65, 18, "Argument of type \'O | undefined\' is not assignable to parameter of type \'O\'.\\n Type \'undefined\' is not assignable to type \'O\'.", "3307950093"]
[51, 65, 18, "Argument of type \'O | undefined\' is not assignable to parameter of type \'O\'.\\n \'O\' could be instantiated with an arbitrary type which could be unrelated to \'O | undefined\'.\\n Type \'undefined\' is not assignable to type \'O\'.\\n \'O\' could be instantiated with an arbitrary type which could be unrelated to \'undefined\'.", "3307950093"]
],
"src/app/file-hash.worker.ts:1230899360": [
[0, 21, 8, "Could not find a declaration file for module \'js-md5\'. \'./node_modules/js-md5/src/md5.js\' implicitly has an \'any\' type.\\n Try \`npm install @types/js-md5\` if it exists or add a new declaration (.d.ts) file containing \`declare module \'js-md5\';\`", "3516231053"]
Expand All @@ -54,17 +36,13 @@ exports[`stricter compilation`] = {
[13, 9, 5, "Property \'color\' has no initializer and is not definitely assigned in the constructor.", "176948952"],
[18, 44, 17, "Argument of type \'string | undefined\' is not assignable to parameter of type \'string\'.\\n Type \'undefined\' is not assignable to type \'string\'.", "463397358"]
],
"src/app/multiple-worker-pool/multiple-worker-pool.component.ts:3896158257": [
[36, 70, 17, "Property \'timelineComponent\' has no initializer and is not definitely assigned in the constructor.", "964610961"],
[44, 10, 9, "Property \'filenames\' has no initializer and is not definitely assigned in the constructor.", "2266034455"],
[53, 9, 15, "Type \'Observable<{}>\' is not assignable to type \'Observable<string[]>\'.\\n Type \'{}\' is missing the following properties from type \'string[]\': length, pop, push, concat, and 26 more.", "3748840825"],
"src/app/multiple-worker-pool/multiple-worker-pool.component.ts:345284253": [
[38, 55, 17, "Property \'timelineComponent\' has no initializer and is not definitely assigned in the constructor.", "964610961"],
[63, 8, 28, "Argument of type \'OperatorFunction<HashWorkerMessage, string | undefined>\' is not assignable to parameter of type \'OperatorFunction<HashWorkerMessage, string>\'.\\n Type \'string | undefined\' is not assignable to type \'string\'.\\n Type \'undefined\' is not assignable to type \'string\'.", "3851287027"],
[88, 9, 14, "Type \'Observable<{ millisSinceLast: number | null; file?: string | undefined; timestamp: Date; message: string; thread: Thread; fileEventType: FileHashEvent | null; }[]>\' is not assignable to type \'Observable<HashWorkerMessage[]>\'.\\n Type \'{ millisSinceLast: number | null; file?: string | undefined; timestamp: Date; message: string; thread: Thread; fileEventType: FileHashEvent | null; }[]\' is not assignable to type \'HashWorkerMessage[]\'.\\n Type \'{ millisSinceLast: number | null; file?: string | undefined; timestamp: Date; message: string; thread: Thread; fileEventType: FileHashEvent | null; }\' is not assignable to type \'HashWorkerMessage\'.\\n Types of property \'millisSinceLast\' are incompatible.\\n Type \'number | null\' is not assignable to type \'number | undefined\'.\\n Type \'null\' is not assignable to type \'number | undefined\'.", "463576723"],
[154, 41, 10, "Argument of type \'string | undefined\' is not assignable to parameter of type \'string\'.\\n Type \'undefined\' is not assignable to type \'string\'.", "4128014593"],
[169, 52, 12, "Variable \'durationName\' is used before being assigned.", "378580668"],
[241, 30, 6, "Parameter \'$event\' implicitly has an \'any\' type.", "3058907597"]
[87, 9, 14, "Type \'Observable<{ millisSinceLast: number | null; file?: string | undefined; timestamp: Date; message: string; thread: Thread; fileEventType: FileHashEvent | null; }[]>\' is not assignable to type \'Observable<HashWorkerMessage[]>\'.\\n Type \'{ millisSinceLast: number | null; file?: string | undefined; timestamp: Date; message: string; thread: Thread; fileEventType: FileHashEvent | null; }[]\' is not assignable to type \'HashWorkerMessage[]\'.\\n Type \'{ millisSinceLast: number | null; file?: string | undefined; timestamp: Date; message: string; thread: Thread; fileEventType: FileHashEvent | null; }\' is not assignable to type \'HashWorkerMessage\'.\\n Types of property \'millisSinceLast\' are incompatible.\\n Type \'number | null\' is not assignable to type \'number | undefined\'.\\n Type \'null\' is not assignable to type \'number | undefined\'.", "463576723"],
[240, 30, 6, "Parameter \'$event\' implicitly has an \'any\' type.", "3058907597"]
],
"src/app/single-worker/single-worker.component.ts:1312378909": [
"src/app/single-worker/single-worker.component.ts:228104130": [
[25, 22, 6, "Parameter \'$event\' implicitly has an \'any\' type.", "3058907597"]
],
"src/readme/worker-pool-hash.worker.ts:2220989309": [
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ jobs:
run: cp LICENSE dist/observable-webworker
- name: Build Demo
if: contains('refs/heads/master', github.ref)
run: yarn run demo:build:prod --progress=false --base-href "https://cloudnc.github.io/observable-webworker/"
run: |
yarn run demo:build:prod --progress=false --base-href "https://cloudnc.github.io/observable-webworker/"
yarn lib:build:prod
- name: Release
if: contains('refs/heads/master refs/heads/next', github.ref)
env:
Expand Down
11 changes: 9 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
Expand All @@ -50,6 +48,10 @@
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
}
Expand Down Expand Up @@ -104,6 +106,11 @@
"options": {
"tsConfig": "projects/observable-webworker/tsconfig.lib.json",
"project": "projects/observable-webworker/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/observable-webworker/tsconfig.lib.prod.json"
}
}
},
"test": {
Expand Down
62 changes: 29 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"demo:lint:check": "yarn run ng lint",
"demo:lint:fix": "yarn run demo:lint:check --fix",
"------------------ LIB COMMANDS -----------------": "",
"lib:build:prod": "yarn run ng build --project observable-webworker",
"lib:build:prod": "yarn run ng build --project observable-webworker --prod",
"lib:build:watch": "yarn run lib:build:prod --watch",
"lib:test:watch": "yarn run ng test --project observable-webworker",
"lib:test:ci": "yarn run ng test --project observable-webworker --watch false --code-coverage",
Expand All @@ -37,54 +37,50 @@
"betterer": "betterer"
},
"dependencies": {
"@angular/animations": "~8.0.0",
"@angular/common": "~8.0.0",
"@angular/compiler": "~8.0.0",
"@angular/core": "~8.0.0",
"@angular/forms": "~8.0.0",
"@angular/platform-browser": "~8.0.0",
"@angular/platform-browser-dynamic": "~8.0.0",
"@angular/router": "~8.0.0",
"@angular/animations": "~10.2.0",
"@angular/common": "~10.2.0",
"@angular/compiler": "~10.2.0",
"@angular/core": "~10.2.0",
"@angular/forms": "~10.2.0",
"@angular/platform-browser": "~10.2.0",
"@angular/platform-browser-dynamic": "~10.2.0",
"@angular/router": "~10.2.0",
"google-charts": "2.0.0",
"js-md5": "0.7.3",
"rxjs": "~6.4.0",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
"rxjs": "~6.6.3",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.800.0",
"@angular-devkit/build-ng-packagr": "~0.800.0",
"@angular/cli": "~8.0.2",
"@angular/compiler-cli": "~8.0.0",
"@angular/language-service": "~8.0.0",
"@angular-devkit/build-angular": "~0.1002.0",
"@angular-devkit/build-ng-packagr": "~0.1002.0",
"@angular/cli": "~10.2.0",
"@angular/compiler-cli": "~10.2.0",
"@angular/language-service": "~10.2.0",
"@betterer/cli": "^1.1.3",
"@betterer/typescript": "^1.1.2",
"@types/google.visualization": "0.0.48",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codecov": "^3.7.1",
"codelyzer": "^5.0.0",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"commitizen": "4.0.3",
"cypress": "3.4.1",
"cz-conventional-changelog": "2.1.0",
"embedme": "1.6.0",
"http-server-spa": "1.3.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"ng-packagr": "^5.1.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"ng-packagr": "^10.1.0",
"prettier": "1.18.2",
"protractor": "~5.4.0",
"semantic-release": "^15.13.12",
"ts-node": "~7.0.0",
"tsickle": "^0.35.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
"tslint": "~6.1.0",
"typescript": "~4.0.3"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion projects/observable-webworker/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function(config) {
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/observable-webworker'),
reports: ['html', 'lcovonly'],
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
Expand Down
3 changes: 3 additions & 0 deletions projects/observable-webworker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"Webpack",
"Multithread"
],
"dependencies": {
"tslib": "^2.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/cloudnc/observable-webworker.git"
Expand Down
46 changes: 23 additions & 23 deletions projects/observable-webworker/src/lib/from-worker-pool.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Notification, NotificationKind } from 'rxjs/internal/Notification';
import { reduce } from 'rxjs/operators';
import { fromWorkerPool } from './from-worker-pool';

// tslint:disable:no-non-null-assertion

describe('fromWorkerPool', () => {
let stubbedWorkers: Worker[];

Expand Down Expand Up @@ -55,9 +57,7 @@ describe('fromWorkerPool', () => {

expect(workerFactorySpy).toHaveBeenCalledTimes(navigator.hardwareConcurrency - 1);

expect(stubbedWorkers[0].postMessage).toHaveBeenCalledWith(
jasmine.objectContaining({ kind: NotificationKind.NEXT, value: 0 }),
);
expect(stubbedWorkers[0].postMessage).toHaveBeenCalledWith(jasmine.objectContaining({ kind: 'N', value: 0 }));

sub.unsubscribe();
});
Expand Down Expand Up @@ -92,17 +92,17 @@ describe('fromWorkerPool', () => {
for (let i = 0; i < navigator.hardwareConcurrency - 1; i++) {
const stubWorker = stubbedWorkers[i];

stubWorker.onmessage(
stubWorker.onmessage!(
new MessageEvent('message', {
data: new Notification(NotificationKind.NEXT, i),
data: new Notification('N', i),
}),
);

expect(subscriptionSpy).toHaveBeenCalledWith(i);

stubWorker.onmessage(
stubWorker.onmessage!(
new MessageEvent('message', {
data: new Notification(NotificationKind.COMPLETE),
data: new Notification('C'),
}),
);

Expand Down Expand Up @@ -133,15 +133,15 @@ describe('fromWorkerPool', () => {
for (const i of input) {
const stubWorker = stubbedWorkers[i % workerCount];

stubWorker.onmessage(
stubWorker.onmessage!(
new MessageEvent('message', {
data: new Notification(NotificationKind.NEXT, i),
data: new Notification('N', i),
}),
);

stubWorker.onmessage(
stubWorker.onmessage!(
new MessageEvent('message', {
data: new Notification(NotificationKind.COMPLETE),
data: new Notification('C'),
}),
);
}
Expand Down Expand Up @@ -185,15 +185,15 @@ describe('fromWorkerPool', () => {
for (const i of generator()) {
const stubWorker = stubbedWorkers[i % workerCount];

stubWorker.onmessage(
stubWorker.onmessage!(
new MessageEvent('message', {
data: new Notification(NotificationKind.NEXT, i),
data: new Notification('N', i),
}),
);

stubWorker.onmessage(
stubWorker.onmessage!(
new MessageEvent('message', {
data: new Notification(NotificationKind.COMPLETE),
data: new Notification('C'),
}),
);
}
Expand Down Expand Up @@ -256,15 +256,15 @@ describe('fromWorkerPool', () => {
setTimeout(() => {
const stubWorker = stubbedWorkers[i % workerCount];

stubWorker.onmessage(
stubWorker.onmessage!(
new MessageEvent('message', {
data: new Notification(NotificationKind.NEXT, input[i]),
data: new Notification('N', input[i]),
}),
);

stubWorker.onmessage(
stubWorker.onmessage!(
new MessageEvent('message', {
data: new Notification(NotificationKind.COMPLETE),
data: new Notification('C'),
}),
);
}, 10 - i); // output each result in successively less time for each value
Expand Down Expand Up @@ -323,15 +323,15 @@ describe('fromWorkerPool', () => {
setTimeout(() => {
const stubWorker = stubbedWorkers[i % workerCount];

stubWorker.onmessage(
stubWorker.onmessage!(
new MessageEvent('message', {
data: new Notification(NotificationKind.NEXT, input[i]),
data: new Notification('N', input[i]),
}),
);

stubWorker.onmessage(
stubWorker.onmessage!(
new MessageEvent('message', {
data: new Notification(NotificationKind.COMPLETE),
data: new Notification('C'),
}),
);
}, 10 - i); // output each result in successively less time for each value
Expand Down
Loading

0 comments on commit 8253341

Please sign in to comment.