Skip to content

Commit 595eb1e

Browse files
committed
upgrade to Angular 19, migrate to standalone, fix other issues
1 parent 6b5b3de commit 595eb1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+8592
-7253
lines changed

package-lock.json

Lines changed: 8273 additions & 6961 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "infopi",
3-
"version": "2.11.0",
3+
"version": "2.12.0",
44
"main": "bootstrap.js",
55
"scripts": {
66
"ng": "ng",
@@ -13,60 +13,60 @@
1313
"electron": "ng build --base-href ./ && electron --no-sandbox .",
1414
"package": "npm run build:prod && node package.js",
1515
"package:rpi": "npm run build:prod && node package.js rpi",
16-
"deploy": "npm run package:rpi && scp dist/installers/infopi_*_arm64.deb yrpi: && ssh yrpi sudo dpkg -i infopi_*_arm64.deb && ssh yrpi rm infopi_*_arm64.deb && npm run restart-infopi",
17-
"restart-infopi": "ssh yrpi killall infopi; ssh yrpi 'env DISPLAY=:0 nohup infopi &>/dev/null &'"
16+
"deploy": "npm run package:rpi && scp dist/installers/infopi_*_arm64.deb infopi: && ssh infopi sudo dpkg -i infopi_*_arm64.deb && ssh infopi rm infopi_*_arm64.deb && npm run restart-infopi",
17+
"restart-infopi": "ssh infopi killall infopi; ssh infopi 'env DISPLAY=:0 nohup infopi &>/dev/null &'"
1818
},
1919
"private": true,
2020
"dependencies": {
21-
"@angular/animations": "^17.3.11",
22-
"@angular/cdk": "^17.3.10",
23-
"@angular/common": "^17.3.11",
24-
"@angular/core": "^17.3.11",
25-
"@angular/platform-browser": "^17.3.11",
26-
"@angular/platform-browser-dynamic": "^17.3.11",
27-
"@angular/forms": "^17.3.11",
28-
"chart.js": "^4.4.3",
29-
"ng2-charts": "^5.0.4",
21+
"@angular/animations": "^19.1.4",
22+
"@angular/cdk": "^19.1.2",
23+
"@angular/common": "^19.1.4",
24+
"@angular/core": "^19.1.4",
25+
"@angular/platform-browser": "^19.1.4",
26+
"@angular/platform-browser-dynamic": "^19.1.4",
27+
"@angular/forms": "^19.1.4",
28+
"chart.js": "^4.4.7",
29+
"ng2-charts": "^8.0.0",
3030
"rxjs": "^7.8.1",
31-
"stream": "^0.0.2",
32-
"tslib": "^2.6.3",
31+
"stream": "^0.0.3",
32+
"tslib": "^2.8.1",
3333
"weather-icons": "github:erikflowers/weather-icons",
3434
"xml-js": "^1.6.11",
35-
"zone.js": "^0.14.7"
35+
"zone.js": "^0.15.0"
3636
},
3737
"devDependencies": {
38-
"@angular-devkit/build-angular": "^17.3.8",
39-
"@angular-eslint/builder": "^17.5.2",
40-
"@angular-eslint/eslint-plugin": "^17.5.2",
41-
"@angular-eslint/eslint-plugin-template": "^17.5.2",
42-
"@angular-eslint/schematics": "^17.5.2",
43-
"@angular-eslint/template-parser": "^17.5.2",
44-
"@angular/cli": "^17.3.8",
45-
"@angular/compiler": "^17.3.11",
46-
"@angular/compiler-cli": "^17.3.11",
47-
"@angular/language-service": "^17.3.11",
48-
"@types/jasmine": "^5.1.4",
49-
"@types/node": "^20.14.2",
50-
"@typescript-eslint/eslint-plugin": "^7.13.0",
51-
"@typescript-eslint/parser": "^7.13.0",
38+
"@angular-devkit/build-angular": "^19.1.5",
39+
"@angular-eslint/builder": "^19.0.2",
40+
"@angular-eslint/eslint-plugin": "^19.0.2",
41+
"@angular-eslint/eslint-plugin-template": "^19.0.2",
42+
"@angular-eslint/schematics": "^19.0.2",
43+
"@angular-eslint/template-parser": "^19.0.2",
44+
"@angular/cli": "^19.1.5",
45+
"@angular/compiler": "^19.1.4",
46+
"@angular/compiler-cli": "^19.1.4",
47+
"@angular/language-service": "^19.1.4",
48+
"@types/jasmine": "^5.1.5",
49+
"@types/node": "^22.13.1",
50+
"@typescript-eslint/eslint-plugin": "^8.23.0",
51+
"@typescript-eslint/parser": "^8.23.0",
5252
"codelyzer": "^6.0.2",
5353
"electron": "^29.4.2",
5454
"electron-installer-debian": "^3.2.0",
5555
"electron-packager": "^17.1.2",
56-
"eslint": "^8.57.0",
57-
"eslint-plugin-import": "^2.29.1",
58-
"eslint-plugin-jsdoc": "^48.2.9",
56+
"eslint": "^8.57.1",
57+
"eslint-plugin-import": "^2.31.0",
58+
"eslint-plugin-jsdoc": "^50.6.3",
5959
"eslint-plugin-prefer-arrow": "^1.2.3",
60-
"jasmine-core": "^5.1.2",
60+
"jasmine-core": "^5.5.0",
6161
"jasmine-reporters": "^2.5.2",
6262
"jasmine-spec-reporter": "^7.0.0",
63-
"karma": "^6.4.3",
63+
"karma": "^6.4.4",
6464
"karma-chrome-launcher": "^3.2.0",
6565
"karma-coverage": "^2.2.1",
6666
"karma-jasmine": "^5.1.0",
6767
"karma-jasmine-html-reporter": "^2.1.0",
68-
"ng-mocks": "^14.13.0",
69-
"typescript": "~5.3.3"
68+
"ng-mocks": "^14.13.2",
69+
"typescript": "~5.7.3"
7070
},
7171
"author": {
7272
"name": "Dmitry Kann",

src/_vars.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ $font-size-xxl: $font-size * 4;
1212
// Base colours
1313
$color-body-bg: #000;
1414
$color-body-fg: #fff;
15+
$color-badge-light-fg: #fff;
16+
$color-badge-light-bg: #888;
1517
$color-pale-fg: #888;
1618
$color-ruler: #666;
1719
$color-ruler-pale: #333;

src/app/_directives/spinner.directive.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { SpinnerDirective } from './spinner.directive';
21
import { Component, DebugElement } from '@angular/core';
32
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
43
import { By } from '@angular/platform-browser';
4+
import { SpinnerDirective } from './spinner.directive';
55

66
@Component({
77
template: '<div [appSpinner]="value"></div>',
8+
imports: [SpinnerDirective],
89
})
910
class TestComponent {
1011
value = false;
@@ -18,7 +19,7 @@ describe('SpinnerDirective', () => {
1819

1920
beforeEach(() => {
2021
fixture = TestBed.configureTestingModule({
21-
declarations: [SpinnerDirective, TestComponent],
22+
imports: [SpinnerDirective, TestComponent],
2223
})
2324
.createComponent(TestComponent);
2425
fixture.detectChanges();

src/app/_pipes/time-ago.pipe.spec.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,20 @@ describe('TimeAgoPipe', () => {
1717
[
1818
{date: undefined, want: ''},
1919
{date: null, want: ''},
20-
{date: new Date(), want: 'Just now'},
21-
{date: new Date(2010, 11, 31, 14, 14, 17), want: 'Just now'},
22-
{date: new Date(2010, 11, 31, 14, 14, 16), want: 'A minute ago'},
20+
{date: new Date(), want: 'just now'},
21+
{date: new Date(2010, 11, 31, 14, 14, 17), want: 'just now'},
22+
{date: new Date(2010, 11, 31, 14, 14, 16), want: '1 minute ago'},
2323
{date: new Date(2010, 11, 31, 14, 0, 0), want: '15 minutes ago'},
24-
{date: new Date(2010, 11, 31, 13, 15, 16), want: 'An hour ago'},
24+
{date: new Date(2010, 11, 31, 13, 15, 16), want: '1 hour ago'},
2525
{date: new Date(2010, 11, 31, 4, 0, 0), want: '10 hours ago'},
26-
{date: new Date(2010, 11, 30, 14, 15, 16), want: 'Yesterday'},
27-
{date: new Date(2010, 11, 1, 14, 15, 16), want: 'A month ago'},
26+
{date: new Date(2010, 11, 30, 14, 15, 16), want: 'yesterday'},
27+
{date: new Date(2010, 11, 1, 14, 15, 16), want: 'last month'},
2828
{date: new Date(2010, 1, 2, 4, 0, 0), want: '11 months ago'},
29-
{date: new Date(2009, 11, 31, 14, 15, 16), want: 'A year ago'},
29+
{date: new Date(2009, 11, 31, 14, 15, 16), want: 'last year'},
3030
{date: new Date(2001, 1, 2, 4, 0, 0), want: '9 years ago'},
31-
].forEach(test =>
32-
it(`returns "${test.want}" when date is ${test.date}`, () => {
33-
expect(pipe.transform(test.date)).toBe(test.want);
34-
}));
31+
]
32+
.forEach(test =>
33+
it(`returns "${test.want}" when date is ${test.date}`, () =>
34+
expect(pipe.transform(test.date)).toBe(test.want)));
35+
3536
});

src/app/_pipes/time-ago.pipe.ts

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,53 +14,39 @@ export class TimeAgoPipe implements PipeTransform {
1414
}
1515

1616
const seconds = Math.floor((new Date().getTime() - d.getTime()) / 1000);
17+
const formatter = new Intl.RelativeTimeFormat('en', {numeric: 'auto'});
1718

1819
// Years
1920
let interval = Math.floor(seconds / 31536000);
20-
if (interval > 1) {
21-
return interval + ' years ago';
22-
}
23-
if (interval === 1) {
24-
return 'A year ago';
21+
if (interval >= 1) {
22+
return formatter.format(-interval, 'year');
2523
}
2624

2725
// Months
2826
interval = Math.floor(seconds / 2592000);
29-
if (interval > 1) {
30-
return interval + ' months ago';
31-
}
32-
if (interval === 1) {
33-
return 'A month ago';
27+
if (interval >= 1) {
28+
return formatter.format(-interval, 'month');
3429
}
3530

3631
// Days
3732
interval = Math.floor(seconds / 86400);
38-
if (interval > 1) {
39-
return interval + ' days ago';
40-
}
41-
if (interval === 1) {
42-
return 'Yesterday';
33+
if (interval >= 1) {
34+
return formatter.format(-interval, 'day');
4335
}
4436

4537
// Hours
4638
interval = Math.floor(seconds / 3600);
47-
if (interval > 1) {
48-
return interval + ' hours ago';
49-
}
50-
if (interval === 1) {
51-
return 'An hour ago';
39+
if (interval >= 1) {
40+
return formatter.format(-interval, 'hour');
5241
}
5342

5443
// Minutes
5544
interval = Math.floor(seconds / 60);
56-
if (interval > 1) {
57-
return interval + ' minutes ago';
58-
}
59-
if (interval === 1) {
60-
return 'A minute ago';
45+
if (interval >= 1) {
46+
return formatter.format(-interval, 'minute');
6147
}
6248

6349
// Less than a minute
64-
return 'Just now';
50+
return 'just now';
6551
}
6652
}

src/app/_pipes/truncate.pipe.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ describe('TruncatePipe', () => {
1313
{in: 'abc', len: 80, want: 'abc'},
1414
{in: 'abc', len: 3, want: 'abc'},
1515
{in: 'abc', len: 2, want: 'a…'},
16-
].forEach(test =>
17-
it(`given "${test.in}" and maxLength=${test.len} returns "${test.want}"`, () =>
18-
expect(pipe.transform(test.in, test.len)).toBe(test.want)));
16+
]
17+
.forEach(test =>
18+
it(`given "${test.in}" and maxLength=${test.len} returns "${test.want}"`, () =>
19+
expect(pipe.transform(test.in, test.len)).toBe(test.want)));
1920
});

src/app/_services/buienradar.service.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { TestBed } from '@angular/core/testing';
2-
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
2+
import { provideHttpClient } from '@angular/common/http';
3+
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
34
import { BuienradarService } from './buienradar.service';
45

56
describe('BuienradarService', () => {
@@ -11,8 +12,9 @@ describe('BuienradarService', () => {
1112

1213
beforeEach(() => {
1314
TestBed.configureTestingModule({
14-
imports: [
15-
HttpClientTestingModule,
15+
providers: [
16+
provideHttpClient(),
17+
provideHttpClientTesting(),
1618
],
1719
});
1820

src/app/_services/fx.service.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { TestBed } from '@angular/core/testing';
2-
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
2+
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
3+
import { provideHttpClient } from '@angular/common/http';
34
import { FxService } from './fx.service';
45
import { ConfigService } from './config.service';
56
import { getConfigServiceMock } from '../_testing/services.mock';
@@ -13,10 +14,9 @@ describe('FxService', () => {
1314

1415
beforeEach(() => {
1516
TestBed.configureTestingModule({
16-
imports: [
17-
HttpClientTestingModule,
18-
],
1917
providers: [
18+
provideHttpClient(),
19+
provideHttpClientTesting(),
2020
{provide: ConfigService, useValue: getConfigServiceMock()},
2121
],
2222
});

src/app/_services/ns.service.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { TestBed } from '@angular/core/testing';
2-
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
2+
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
3+
import { provideHttpClient } from '@angular/common/http';
34
import { NsService } from './ns.service';
45
import { ConfigService } from './config.service';
56
import { getConfigServiceMock } from '../_testing/services.mock';
@@ -13,10 +14,9 @@ describe('NsService', () => {
1314

1415
beforeEach(() => {
1516
TestBed.configureTestingModule({
16-
imports: [
17-
HttpClientTestingModule,
18-
],
1917
providers: [
18+
provideHttpClient(),
19+
provideHttpClientTesting(),
2020
{provide: ConfigService, useValue: getConfigServiceMock({api: {nsApiKey: 'SECRET_NS_API_KEY'}})},
2121
],
2222
});

0 commit comments

Comments
 (0)