Skip to content

Commit 8253341

Browse files
authored
Merge pull request #58 from cloudnc/feat/upgrade-angular-typescript
2 parents 469c0bc + 43d9c12 commit 8253341

23 files changed

Lines changed: 4135 additions & 2540 deletions

.betterer.results

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,19 @@
11
// BETTERER RESULTS V1.
22
exports[`stricter compilation`] = {
3-
timestamp: 1589991341747,
3+
timestamp: 1603555076420,
44
value: `{
5-
"projects/observable-webworker/src/lib/from-worker-pool.spec.ts:723302687": [
6-
[94, 8, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
7-
[102, 8, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
8-
[135, 8, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
9-
[141, 8, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
10-
[187, 8, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
11-
[193, 8, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
12-
[258, 10, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
13-
[264, 10, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
14-
[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"],
15-
[325, 10, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
16-
[331, 10, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"]
5+
"projects/observable-webworker/src/lib/from-worker-pool.spec.ts:2815790124": [
6+
[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"]
177
],
18-
"projects/observable-webworker/src/lib/from-worker.spec.ts:2304322660": [
19-
[9, 6, 16, "Variable \'workerFactorySpy\' implicitly has type \'any\' in some locations where its type cannot be determined.", "4184968637"],
20-
[25, 11, 16, "Variable \'workerFactorySpy\' implicitly has an \'any\' type.", "4184968637"],
21-
[30, 11, 16, "Variable \'workerFactorySpy\' implicitly has an \'any\' type.", "4184968637"],
22-
[75, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
23-
[83, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
24-
[98, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
25-
[114, 4, 18, "Cannot invoke an object which is possibly \'null\'.", "3118492308"],
26-
[148, 11, 16, "Variable \'workerFactorySpy\' implicitly has an \'any\' type.", "4184968637"],
27-
[167, 65, 16, "Variable \'workerFactorySpy\' implicitly has an \'any\' type.", "4184968637"],
28-
[178, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
29-
[184, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"]
8+
"projects/observable-webworker/src/lib/from-worker.spec.ts:2047567224": [
9+
[92, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
10+
[171, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"],
11+
[177, 4, 20, "Cannot invoke an object which is possibly \'null\'.", "650422727"]
3012
],
3113
"projects/observable-webworker/src/lib/from-worker.ts:4009652202": [
32-
[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"]
14+
[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"]
3315
],
34-
"projects/observable-webworker/src/lib/run-worker.spec.ts:4277544177": [
16+
"projects/observable-webworker/src/lib/run-worker.spec.ts:1321560577": [
3517
[19, 8, 17, "Type \'undefined\' is not assignable to type \'Observable<number>\'.", "4204377774"],
3618
[25, 8, 17, "Type \'undefined\' is not assignable to type \'Observable<number>\'.", "4204377774"],
3719
[38, 8, 17, "Type \'undefined\' is not assignable to type \'Observable<number>\'.", "4204377774"],
@@ -40,7 +22,7 @@ exports[`stricter compilation`] = {
4022
"projects/observable-webworker/src/lib/run-worker.ts:1913596105": [
4123
[4, 65, 7, "Rest parameter \'args\' implicitly has an \'any[]\' type.", "3622679692"],
4224
[51, 38, 26, "Cannot invoke an object which is possibly \'undefined\'.", "4028913799"],
43-
[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"]
25+
[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"]
4426
],
4527
"src/app/file-hash.worker.ts:1230899360": [
4628
[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"]
@@ -54,17 +36,13 @@ exports[`stricter compilation`] = {
5436
[13, 9, 5, "Property \'color\' has no initializer and is not definitely assigned in the constructor.", "176948952"],
5537
[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"]
5638
],
57-
"src/app/multiple-worker-pool/multiple-worker-pool.component.ts:3896158257": [
58-
[36, 70, 17, "Property \'timelineComponent\' has no initializer and is not definitely assigned in the constructor.", "964610961"],
59-
[44, 10, 9, "Property \'filenames\' has no initializer and is not definitely assigned in the constructor.", "2266034455"],
60-
[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"],
39+
"src/app/multiple-worker-pool/multiple-worker-pool.component.ts:345284253": [
40+
[38, 55, 17, "Property \'timelineComponent\' has no initializer and is not definitely assigned in the constructor.", "964610961"],
6141
[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"],
62-
[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"],
63-
[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"],
64-
[169, 52, 12, "Variable \'durationName\' is used before being assigned.", "378580668"],
65-
[241, 30, 6, "Parameter \'$event\' implicitly has an \'any\' type.", "3058907597"]
42+
[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"],
43+
[240, 30, 6, "Parameter \'$event\' implicitly has an \'any\' type.", "3058907597"]
6644
],
67-
"src/app/single-worker/single-worker.component.ts:1312378909": [
45+
"src/app/single-worker/single-worker.component.ts:228104130": [
6846
[25, 22, 6, "Parameter \'$event\' implicitly has an \'any\' type.", "3058907597"]
6947
],
7048
"src/readme/worker-pool-hash.worker.ts:2220989309": [
File renamed without changes.

.github/workflows/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ jobs:
4343
run: cp LICENSE dist/observable-webworker
4444
- name: Build Demo
4545
if: contains('refs/heads/master', github.ref)
46-
run: yarn run demo:build:prod --progress=false --base-href "https://cloudnc.github.io/observable-webworker/"
46+
run: |
47+
yarn run demo:build:prod --progress=false --base-href "https://cloudnc.github.io/observable-webworker/"
48+
yarn lib:build:prod
4749
- name: Release
4850
if: contains('refs/heads/master refs/heads/next', github.ref)
4951
env:

angular.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@
3838
],
3939
"optimization": true,
4040
"outputHashing": "all",
41-
"sourceMap": false,
4241
"extractCss": true,
4342
"namedChunks": false,
44-
"aot": true,
4543
"extractLicenses": true,
4644
"vendorChunk": false,
4745
"buildOptimizer": true,
@@ -50,6 +48,10 @@
5048
"type": "initial",
5149
"maximumWarning": "2mb",
5250
"maximumError": "5mb"
51+
},
52+
{
53+
"type": "anyComponentStyle",
54+
"maximumWarning": "6kb"
5355
}
5456
]
5557
}
@@ -104,6 +106,11 @@
104106
"options": {
105107
"tsConfig": "projects/observable-webworker/tsconfig.lib.json",
106108
"project": "projects/observable-webworker/ng-package.json"
109+
},
110+
"configurations": {
111+
"production": {
112+
"tsConfig": "projects/observable-webworker/tsconfig.lib.prod.json"
113+
}
107114
}
108115
},
109116
"test": {

package.json

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"demo:lint:check": "yarn run ng lint",
2121
"demo:lint:fix": "yarn run demo:lint:check --fix",
2222
"------------------ LIB COMMANDS -----------------": "",
23-
"lib:build:prod": "yarn run ng build --project observable-webworker",
23+
"lib:build:prod": "yarn run ng build --project observable-webworker --prod",
2424
"lib:build:watch": "yarn run lib:build:prod --watch",
2525
"lib:test:watch": "yarn run ng test --project observable-webworker",
2626
"lib:test:ci": "yarn run ng test --project observable-webworker --watch false --code-coverage",
@@ -37,54 +37,50 @@
3737
"betterer": "betterer"
3838
},
3939
"dependencies": {
40-
"@angular/animations": "~8.0.0",
41-
"@angular/common": "~8.0.0",
42-
"@angular/compiler": "~8.0.0",
43-
"@angular/core": "~8.0.0",
44-
"@angular/forms": "~8.0.0",
45-
"@angular/platform-browser": "~8.0.0",
46-
"@angular/platform-browser-dynamic": "~8.0.0",
47-
"@angular/router": "~8.0.0",
40+
"@angular/animations": "~10.2.0",
41+
"@angular/common": "~10.2.0",
42+
"@angular/compiler": "~10.2.0",
43+
"@angular/core": "~10.2.0",
44+
"@angular/forms": "~10.2.0",
45+
"@angular/platform-browser": "~10.2.0",
46+
"@angular/platform-browser-dynamic": "~10.2.0",
47+
"@angular/router": "~10.2.0",
4848
"google-charts": "2.0.0",
4949
"js-md5": "0.7.3",
50-
"rxjs": "~6.4.0",
51-
"tslib": "^1.9.0",
52-
"zone.js": "~0.9.1"
50+
"rxjs": "~6.6.3",
51+
"tslib": "^2.0.0",
52+
"zone.js": "~0.10.2"
5353
},
5454
"devDependencies": {
55-
"@angular-devkit/build-angular": "~0.800.0",
56-
"@angular-devkit/build-ng-packagr": "~0.800.0",
57-
"@angular/cli": "~8.0.2",
58-
"@angular/compiler-cli": "~8.0.0",
59-
"@angular/language-service": "~8.0.0",
55+
"@angular-devkit/build-angular": "~0.1002.0",
56+
"@angular-devkit/build-ng-packagr": "~0.1002.0",
57+
"@angular/cli": "~10.2.0",
58+
"@angular/compiler-cli": "~10.2.0",
59+
"@angular/language-service": "~10.2.0",
6060
"@betterer/cli": "^1.1.3",
6161
"@betterer/typescript": "^1.1.2",
6262
"@types/google.visualization": "0.0.48",
6363
"@types/jasmine": "~3.3.8",
6464
"@types/jasminewd2": "~2.0.3",
65-
"@types/node": "~8.9.4",
66-
"codecov": "^3.7.1",
67-
"codelyzer": "^5.0.0",
65+
"@types/node": "^12.11.1",
66+
"codelyzer": "^6.0.0",
6867
"commitizen": "4.0.3",
6968
"cypress": "3.4.1",
7069
"cz-conventional-changelog": "2.1.0",
7170
"embedme": "1.6.0",
72-
"http-server-spa": "1.3.0",
73-
"jasmine-core": "~3.4.0",
74-
"jasmine-spec-reporter": "~4.2.1",
75-
"karma": "~4.1.0",
76-
"karma-chrome-launcher": "~2.2.0",
77-
"karma-coverage-istanbul-reporter": "~2.0.1",
78-
"karma-jasmine": "~2.0.1",
79-
"karma-jasmine-html-reporter": "^1.4.0",
80-
"ng-packagr": "^5.1.0",
71+
"jasmine-core": "~3.6.0",
72+
"jasmine-spec-reporter": "~5.0.0",
73+
"karma": "~5.0.0",
74+
"karma-chrome-launcher": "~3.1.0",
75+
"karma-coverage-istanbul-reporter": "~3.0.2",
76+
"karma-jasmine": "~4.0.0",
77+
"karma-jasmine-html-reporter": "^1.5.0",
78+
"ng-packagr": "^10.1.0",
8179
"prettier": "1.18.2",
82-
"protractor": "~5.4.0",
8380
"semantic-release": "^15.13.12",
8481
"ts-node": "~7.0.0",
85-
"tsickle": "^0.35.0",
86-
"tslint": "~5.15.0",
87-
"typescript": "~3.4.3"
82+
"tslint": "~6.1.0",
83+
"typescript": "~4.0.3"
8884
},
8985
"repository": {
9086
"type": "git",

projects/observable-webworker/karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = function(config) {
1717
},
1818
coverageIstanbulReporter: {
1919
dir: require('path').join(__dirname, '../../coverage/observable-webworker'),
20-
reports: ['html', 'lcovonly'],
20+
reports: ['html', 'lcovonly', 'text-summary'],
2121
fixWebpackSourcePaths: true,
2222
},
2323
reporters: ['progress', 'kjhtml'],

projects/observable-webworker/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
"Webpack",
2222
"Multithread"
2323
],
24+
"dependencies": {
25+
"tslib": "^2.0.0"
26+
},
2427
"repository": {
2528
"type": "git",
2629
"url": "https://github.com/cloudnc/observable-webworker.git"

projects/observable-webworker/src/lib/from-worker-pool.spec.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { Notification, NotificationKind } from 'rxjs/internal/Notification';
44
import { reduce } from 'rxjs/operators';
55
import { fromWorkerPool } from './from-worker-pool';
66

7+
// tslint:disable:no-non-null-assertion
8+
79
describe('fromWorkerPool', () => {
810
let stubbedWorkers: Worker[];
911

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

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

58-
expect(stubbedWorkers[0].postMessage).toHaveBeenCalledWith(
59-
jasmine.objectContaining({ kind: NotificationKind.NEXT, value: 0 }),
60-
);
60+
expect(stubbedWorkers[0].postMessage).toHaveBeenCalledWith(jasmine.objectContaining({ kind: 'N', value: 0 }));
6161

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

95-
stubWorker.onmessage(
95+
stubWorker.onmessage!(
9696
new MessageEvent('message', {
97-
data: new Notification(NotificationKind.NEXT, i),
97+
data: new Notification('N', i),
9898
}),
9999
);
100100

101101
expect(subscriptionSpy).toHaveBeenCalledWith(i);
102102

103-
stubWorker.onmessage(
103+
stubWorker.onmessage!(
104104
new MessageEvent('message', {
105-
data: new Notification(NotificationKind.COMPLETE),
105+
data: new Notification('C'),
106106
}),
107107
);
108108

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

136-
stubWorker.onmessage(
136+
stubWorker.onmessage!(
137137
new MessageEvent('message', {
138-
data: new Notification(NotificationKind.NEXT, i),
138+
data: new Notification('N', i),
139139
}),
140140
);
141141

142-
stubWorker.onmessage(
142+
stubWorker.onmessage!(
143143
new MessageEvent('message', {
144-
data: new Notification(NotificationKind.COMPLETE),
144+
data: new Notification('C'),
145145
}),
146146
);
147147
}
@@ -185,15 +185,15 @@ describe('fromWorkerPool', () => {
185185
for (const i of generator()) {
186186
const stubWorker = stubbedWorkers[i % workerCount];
187187

188-
stubWorker.onmessage(
188+
stubWorker.onmessage!(
189189
new MessageEvent('message', {
190-
data: new Notification(NotificationKind.NEXT, i),
190+
data: new Notification('N', i),
191191
}),
192192
);
193193

194-
stubWorker.onmessage(
194+
stubWorker.onmessage!(
195195
new MessageEvent('message', {
196-
data: new Notification(NotificationKind.COMPLETE),
196+
data: new Notification('C'),
197197
}),
198198
);
199199
}
@@ -256,15 +256,15 @@ describe('fromWorkerPool', () => {
256256
setTimeout(() => {
257257
const stubWorker = stubbedWorkers[i % workerCount];
258258

259-
stubWorker.onmessage(
259+
stubWorker.onmessage!(
260260
new MessageEvent('message', {
261-
data: new Notification(NotificationKind.NEXT, input[i]),
261+
data: new Notification('N', input[i]),
262262
}),
263263
);
264264

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

326-
stubWorker.onmessage(
326+
stubWorker.onmessage!(
327327
new MessageEvent('message', {
328-
data: new Notification(NotificationKind.NEXT, input[i]),
328+
data: new Notification('N', input[i]),
329329
}),
330330
);
331331

332-
stubWorker.onmessage(
332+
stubWorker.onmessage!(
333333
new MessageEvent('message', {
334-
data: new Notification(NotificationKind.COMPLETE),
334+
data: new Notification('C'),
335335
}),
336336
);
337337
}, 10 - i); // output each result in successively less time for each value

0 commit comments

Comments
 (0)