Skip to content

Commit 49e16aa

Browse files
authored
Merge pull request #85 from cloudnc/feat/upgrade-angular
2 parents c9d08ab + 34b053a commit 49e16aa

29 files changed

Lines changed: 4471 additions & 4301 deletions

.betterer.results

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
exports[`stricter compilation`] = {
33
timestamp: 1619240872304,
44
value: `{
5+
"node_modules/@types/jasmine/index.d.ts:2472745569": [
6+
[669, 14, 16, "Interface \'FunctionMatchers<Fn>\' incorrectly extends interface \'Matchers<any>\'.\\n The types returned by \'toHaveBeenCalledWith(...)\' are incompatible between these types.\\n Type \'boolean\' is not assignable to type \'Promise<void>\'.", "2718731728"]
7+
],
58
"src/app/google-charts.service.ts:1308226900": [
6-
[3, 29, 15, "Could not find a declaration file for module \'google-charts\'. \'./node_modules/google-charts/dist/googleCharts.js\' implicitly has an \'any\' type.\\n Try \`npm install @types/google-charts\` if it exists or add a new declaration (.d.ts) file containing \`declare module \'google-charts\';\`", "2535818334"]
9+
[3, 29, 15, "Could not find a declaration file for module \'google-charts\'. \'./node_modules/google-charts/dist/googleCharts.js\' implicitly has an \'any\' type.\\n Try \`npm i --save-dev @types/google-charts\` if it exists or add a new declaration (.d.ts) file containing \`declare module \'google-charts\';\`", "2535818334"]
710
],
811
"src/app/multiple-worker-pool/log-line/log-line.component.ts:1269916813": [
912
[10, 11, 7, "Property \'message\' has no initializer and is not definitely assigned in the constructor.", "1236122734"],
1013
[11, 11, 5, "Property \'files\' has no initializer and is not definitely assigned in the constructor.", "171232592"],
1114
[13, 9, 5, "Property \'color\' has no initializer and is not definitely assigned in the constructor.", "176948952"],
1215
[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"]
1316
],
14-
"src/app/multiple-worker-pool/multiple-worker-pool.component.ts:1042385498": [
17+
"src/app/multiple-worker-pool/multiple-worker-pool.component.ts:816086637": [
1518
[90, 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"]
1619
]
1720
}`

.eslintrc.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": ["projects/**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"parserOptions": {
8+
"project": ["tsconfig.json", "e2e/tsconfig.json"],
9+
"createDefaultProgram": true
10+
},
11+
"extends": ["plugin:@angular-eslint/recommended", "plugin:@angular-eslint/template/process-inline-templates"],
12+
"rules": {
13+
"@angular-eslint/component-selector": [
14+
"error",
15+
{
16+
"prefix": "lib",
17+
"style": "kebab-case",
18+
"type": "element"
19+
}
20+
],
21+
"@angular-eslint/directive-selector": [
22+
"error",
23+
{
24+
"prefix": "lib",
25+
"style": "camelCase",
26+
"type": "attribute"
27+
}
28+
]
29+
}
30+
},
31+
{
32+
"files": ["*.html"],
33+
"extends": ["plugin:@angular-eslint/template/recommended"],
34+
"rules": {}
35+
}
36+
]
37+
}

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ jobs:
3030
- name: Test
3131
run: yarn lib:test:ci
3232
- name: Coverage
33-
uses: codecov/codecov-action@v1
33+
uses: codecov/codecov-action@v2
3434
with:
3535
fail_ci_if_error: true # optional (default = false)
36+
directory: coverage
3637
- name: Build
3738
run: yarn lib:build:prod
3839
- name: Incremental code quality checking

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ speed-measure-plugin.json
3232
.history/*
3333

3434
# misc
35+
/.angular/cache
3536
/.sass-cache
3637
/connect.lock
3738
/coverage

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ import { of } from 'rxjs';
7272

7373
const input$ = of('Hello from main thread');
7474

75-
fromWorker<string, string>(() => new Worker('./hello.worker', { type: 'module' }), input$).subscribe(message => {
75+
fromWorker<string, string>(
76+
() => new Worker(new URL('./hello.worker', import.meta.url), { type: 'module' }),
77+
input$,
78+
).subscribe(message => {
7679
console.log(message); // Outputs 'Hello from webworker'
7780
});
7881

@@ -154,7 +157,7 @@ call to select which elements of the input stream are transferable.
154157
// src/readme/transferable.main.ts#L7-L11
155158

156159
return fromWorker<ArrayBuffer, string>(
157-
() => new Worker('./transferable.worker', { type: 'module' }),
160+
() => new Worker(new URL('./transferable.worker', import.meta.url), { type: 'module' }),
158161
input$,
159162
input => [input],
160163
);
@@ -204,7 +207,10 @@ import { Observable } from 'rxjs';
204207
import { fromWorkerPool } from 'observable-webworker';
205208

206209
export function computeHashes(files: File[]): Observable<string> {
207-
return fromWorkerPool<File, string>(() => new Worker('./worker-pool-hash.worker', { type: 'module' }), files);
210+
return fromWorkerPool<File, string>(
211+
() => new Worker(new URL('./worker-pool-hash.worker', import.meta.url), { type: 'module' }),
212+
files,
213+
);
208214
}
209215

210216
```

angular.json

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@
2222
"main": "src/main.ts",
2323
"polyfills": "src/polyfills.ts",
2424
"tsConfig": "tsconfig.app.json",
25-
"aot": true,
2625
"assets": ["src/favicon.ico", "src/assets"],
2726
"styles": ["src/styles.scss"],
2827
"scripts": [],
29-
"webWorkerTsConfig": "tsconfig.worker.json"
28+
"webWorkerTsConfig": "tsconfig.worker.json",
29+
"vendorChunk": true,
30+
"extractLicenses": false,
31+
"buildOptimizer": false,
32+
"sourceMap": true,
33+
"optimization": false,
34+
"namedChunks": true
3035
},
3136
"configurations": {
3237
"production": {
@@ -38,7 +43,6 @@
3843
],
3944
"optimization": true,
4045
"outputHashing": "all",
41-
"extractCss": true,
4246
"namedChunks": false,
4347
"extractLicenses": true,
4448
"vendorChunk": false,
@@ -55,7 +59,8 @@
5559
}
5660
]
5761
}
58-
}
62+
},
63+
"defaultConfiguration": ""
5964
},
6065
"serve": {
6166
"builder": "@angular-devkit/build-angular:dev-server",
@@ -85,13 +90,6 @@
8590
"styles": ["src/styles.scss"],
8691
"scripts": []
8792
}
88-
},
89-
"lint": {
90-
"builder": "@angular-devkit/build-angular:tslint",
91-
"options": {
92-
"tsConfig": ["tsconfig.app.json", "tsconfig.spec.json", "tsconfig.worker.json"],
93-
"exclude": ["**/node_modules/**"]
94-
}
9593
}
9694
}
9795
},
@@ -102,7 +100,7 @@
102100
"prefix": "lib",
103101
"architect": {
104102
"build": {
105-
"builder": "@angular-devkit/build-ng-packagr:build",
103+
"builder": "@angular-devkit/build-angular:ng-packagr",
106104
"options": {
107105
"tsConfig": "projects/observable-webworker/tsconfig.lib.json",
108106
"project": "projects/observable-webworker/ng-package.json"
@@ -122,17 +120,16 @@
122120
}
123121
},
124122
"lint": {
125-
"builder": "@angular-devkit/build-angular:tslint",
123+
"builder": "@angular-eslint/builder:lint",
126124
"options": {
127-
"tsConfig": [
128-
"projects/observable-webworker/tsconfig.lib.json",
129-
"projects/observable-webworker/tsconfig.spec.json"
130-
],
131-
"exclude": ["**/node_modules/**"]
125+
"lintFilePatterns": ["projects/observable-webworker/**/*.ts", "projects/observable-webworker/**/*.html"]
132126
}
133127
}
134128
}
135129
}
136130
},
137-
"defaultProject": "observable-webworker-demo"
131+
"defaultProject": "observable-webworker-demo",
132+
"cli": {
133+
"defaultCollection": "@angular-eslint/schematics"
134+
}
138135
}

karma.conf.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,31 @@ module.exports = function (config) {
77
frameworks: ['jasmine', '@angular-devkit/build-angular'],
88
plugins: [
99
require('karma-jasmine'),
10+
require('karma-coverage'),
1011
require('karma-chrome-launcher'),
1112
require('karma-jasmine-html-reporter'),
12-
require('karma-coverage-istanbul-reporter'),
1313
require('@angular-devkit/build-angular/plugins/karma'),
1414
],
1515
client: {
1616
clearContext: false, // leave Jasmine Spec Runner output visible in browser
1717
},
18-
coverageIstanbulReporter: {
19-
dir: require('path').join(__dirname, './coverage/observable-webworker'),
20-
reports: ['html', 'lcovonly', 'text-summary'],
21-
fixWebpackSourcePaths: true,
18+
reporters: ['progress', 'kjhtml', 'coverage'],
19+
coverageReporter: {
20+
// specify a common output directory
21+
dir: require('path').join(__dirname, '../../coverage/observable-webworker'),
22+
reporters: [
23+
// reporters not supporting the `file` property
24+
{ type: 'html', subdir: 'report-html' },
25+
// { type: 'lcov', subdir: 'report-lcov' },
26+
// reporters supporting the `file` property, use `subdir` to directly
27+
// output them in the `dir` directory
28+
// { type: 'cobertura', subdir: '.', file: 'cobertura.txt' },
29+
{ type: 'lcovonly', subdir: '.', file: 'lcov.info' },
30+
// { type: 'teamcity', subdir: '.', file: 'teamcity.txt' },
31+
// { type: 'text', subdir: '.', file: 'text.txt' },
32+
{ type: 'text-summary', subdir: '.', file: 'text-summary.txt' },
33+
],
2234
},
23-
reporters: ['progress', 'kjhtml'],
2435
port: 9876,
2536
colors: true,
2637
logLevel: config.LOG_INFO,

package.json

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
"------------------ DEMO COMMANDS -----------------": "",
1414
"demo:start": "yarn run ng serve",
1515
"demo:build:base": "yarn run ng build",
16-
"demo:build:prod": "yarn run demo:build:base --prod",
16+
"demo:build:prod": "yarn run demo:build:base --configuration=production",
1717
"demo:test": "yarn run ng test",
1818
"demo:test:e2e:watch": "yarn run cy open",
1919
"demo:test:e2e:ci": "yarn run cy run",
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 --prod",
23+
"lib:build:prod": "yarn run ng build --project observable-webworker --configuration=production",
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",
@@ -34,54 +34,60 @@
3434
"test": "yarn lib:test:watch --code-coverage",
3535
"start": "yarn demo:start",
3636
"commit": "git add . && git-cz",
37-
"betterer": "betterer"
37+
"betterer": "betterer",
38+
"lint": "ng lint"
3839
},
3940
"dependencies": {
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",
41+
"@angular/animations": "~13.1.2",
42+
"@angular/common": "~13.1.2",
43+
"@angular/compiler": "~13.1.2",
44+
"@angular/core": "~13.1.2",
45+
"@angular/forms": "~13.1.2",
46+
"@angular/platform-browser": "~13.1.2",
47+
"@angular/platform-browser-dynamic": "~13.1.2",
48+
"@angular/router": "~13.1.2",
4849
"google-charts": "2.0.0",
4950
"js-md5": "0.7.3",
5051
"rxjs": "~6.6.3",
51-
"tslib": "^2.0.0",
52-
"zone.js": "~0.10.2"
52+
"tslib": "^2.3.1",
53+
"zone.js": "~0.11.4"
5354
},
5455
"devDependencies": {
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",
56+
"@angular-devkit/build-angular": "~13.1.3",
57+
"@angular-eslint/builder": "13.0.1",
58+
"@angular-eslint/eslint-plugin": "13.0.1",
59+
"@angular-eslint/eslint-plugin-template": "13.0.1",
60+
"@angular-eslint/schematics": "13.0.1",
61+
"@angular-eslint/template-parser": "13.0.1",
62+
"@angular/cli": "~13.1.3",
63+
"@angular/compiler-cli": "~13.1.2",
64+
"@angular/language-service": "~13.1.2",
6065
"@betterer/cli": "^1.1.3",
6166
"@betterer/typescript": "^1.1.2",
6267
"@types/google.visualization": "0.0.48",
63-
"@types/jasmine": "~3.3.8",
68+
"@types/jasmine": "~3.6.0",
6469
"@types/jasminewd2": "~2.0.3",
6570
"@types/js-md5": "^0.4.2",
6671
"@types/node": "^12.11.1",
67-
"codelyzer": "^6.0.0",
72+
"@typescript-eslint/eslint-plugin": "5.3.0",
73+
"@typescript-eslint/parser": "5.3.0",
6874
"commitizen": "4.0.3",
6975
"cypress": "3.4.1",
7076
"cz-conventional-changelog": "2.1.0",
7177
"embedme": "1.6.0",
78+
"eslint": "^8.2.0",
7279
"jasmine-core": "~3.6.0",
7380
"jasmine-spec-reporter": "~5.0.0",
74-
"karma": "~5.0.0",
81+
"karma": "~6.3.11",
7582
"karma-chrome-launcher": "~3.1.0",
76-
"karma-coverage-istanbul-reporter": "~3.0.2",
83+
"karma-coverage": "2.1.0",
7784
"karma-jasmine": "~4.0.0",
7885
"karma-jasmine-html-reporter": "^1.5.0",
79-
"ng-packagr": "^10.1.0",
86+
"ng-packagr": "^13.1.3",
8087
"prettier": "2.2.1",
8188
"semantic-release": "^17.2.3",
8289
"ts-node": "~7.0.0",
83-
"tslint": "~6.1.0",
84-
"typescript": "~4.0.3"
90+
"typescript": "~4.5.4"
8591
},
8692
"repository": {
8793
"type": "git",
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"extends": "../../.eslintrc.json",
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"parserOptions": {
8+
"project": [
9+
"projects/observable-webworker/tsconfig.lib.json",
10+
"projects/observable-webworker/tsconfig.spec.json"
11+
],
12+
"createDefaultProgram": true
13+
},
14+
"rules": {
15+
"@angular-eslint/directive-selector": [
16+
"error",
17+
{
18+
"type": "attribute",
19+
"prefix": "lib",
20+
"style": "camelCase"
21+
}
22+
],
23+
"@angular-eslint/component-selector": [
24+
"error",
25+
{
26+
"type": "element",
27+
"prefix": "lib",
28+
"style": "kebab-case"
29+
}
30+
]
31+
}
32+
},
33+
{
34+
"files": ["*.html"],
35+
"rules": {}
36+
}
37+
]
38+
}

0 commit comments

Comments
 (0)