Skip to content

Commit 5595934

Browse files
Upgrade Angular support to Angular 18 and 19 (#2403)
* Upgrade angular packages to support Angular 18 and 19. Develop against Angular 18. * Update all packages to Typescript ~5.5.0. * angular-material: Use a Angular workspace and remove custom build and test scripts, and test.ts. * Add Angular version increase to migration guide --------- Co-authored-by: Laurent Grangier <laurent.grangier@codeblock.ch>
1 parent fcef896 commit 5595934

Some content is hidden

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

60 files changed

+7270
-16676
lines changed

MIGRATION.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Migration guide
22

3+
## Migrating to JSON Forms 3.5
4+
5+
### Angular support now targets Angular 18 and Angular 19
6+
7+
When using JSON Forms 3.5, your Angular application now needs to target Angular 18 or 19.
8+
9+
Use JSON Forms 3.4 if you need to stay on Angular 17.
10+
311
## Migrating to JSON Forms 3.3
412

513
### Angular support now targets Angular 17 and Angular 18

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"build:examples-app": "lerna run build:examples-app && node packages/examples-app/prepare-examples-app.js"
2121
},
2222
"devDependencies": {
23-
"@angular/core": "^17.0.0",
23+
"@angular/core": "^18.0.0",
24+
"@angular/cli": "^18.0.0",
2425
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5",
2526
"@babel/plugin-proposal-optional-chaining": "^7.16.5",
2627
"@istanbuljs/nyc-config-typescript": "^1.0.2",
@@ -44,7 +45,7 @@
4445
"ts-loader": "^9.5.1",
4546
"ts-node": "^10.4.0",
4647
"tslib": "^2.5.0",
47-
"typescript": "~5.2.2",
48+
"typescript": "~5.5.0",
4849
"webpack": "^5.78.0",
4950
"webpack-merge": "^5.10.0"
5051
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"$schema": "../../node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": ".",
5+
"projects": {
6+
"example": {
7+
"projectType": "application",
8+
"schematics": {
9+
"@schematics/angular:component": {
10+
"style": "scss"
11+
}
12+
},
13+
"root": "example",
14+
"sourceRoot": "example",
15+
"prefix": "app",
16+
"architect": {
17+
"build": {
18+
"builder": "@angular-devkit/build-angular:browser",
19+
"options": {
20+
"outputPath": "example/dist/",
21+
"index": "example/index.html",
22+
"main": "example/main.ts",
23+
"polyfills": [
24+
"zone.js"
25+
],
26+
"tsConfig": "tsconfig.example.json",
27+
"inlineStyleLanguage": "scss",
28+
"assets": [],
29+
"styles": [
30+
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
31+
],
32+
"scripts": [],
33+
"allowedCommonJsDependencies": [
34+
"lodash",
35+
"hammerjs"
36+
],
37+
"optimization": false,
38+
"buildOptimizer": false
39+
}
40+
},
41+
"serve": {
42+
"builder": "@angular-devkit/build-angular:dev-server"
43+
}
44+
}
45+
},
46+
"angular-material": {
47+
"projectType": "library",
48+
"root": ".",
49+
"sourceRoot": ".",
50+
"prefix": "lib",
51+
"architect": {
52+
"build": {
53+
"builder": "@angular-devkit/build-angular:ng-packagr",
54+
"options": {
55+
"project": "ng-package.json"
56+
},
57+
"configurations": {
58+
"production": {
59+
"tsConfig": "tsconfig.json"
60+
},
61+
"development": {
62+
"tsConfig": "tsconfig.json"
63+
}
64+
},
65+
"defaultConfiguration": "production"
66+
},
67+
"test": {
68+
"builder": "@angular-devkit/build-angular:karma",
69+
"options": {
70+
"karmaConfig": "karma.conf.js",
71+
"tsConfig": "tsconfig.spec.json",
72+
"polyfills": [
73+
"zone.js",
74+
"zone.js/testing"
75+
]
76+
}
77+
}
78+
}
79+
}
80+
}
81+
}

packages/angular-material/build-example.js

Lines changed: 0 additions & 73 deletions
This file was deleted.

packages/angular-material/build-package.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/angular-material/example/app/app.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ const itemTester: UISchemaTester = (_schema, schemaPath, _path) => {
8787
[readonly]="readonly"
8888
></jsonforms>
8989
`,
90+
standalone: false,
9091
})
9192
export class AppComponent {
9293
readonly renderers = angularMaterialRenderers;

packages/angular-material/karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = function (config) {
3333
},
3434
reporters: ['progress', 'kjhtml', 'dots'],
3535

36-
browsers: [ config.singleRun ? 'ChromeHeadlessNoSandbox' : 'Chrome' ],
36+
browsers: [ 'ChromeHeadlessNoSandbox' ],
3737
customLaunchers: {
3838
ChromeHeadlessNoSandbox: {
3939
base: 'ChromeHeadless',

packages/angular-material/package.json

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@
3737
"module": "./lib/fesm2022/jsonforms-angular-material.mjs",
3838
"typings": "./lib/index.d.ts",
3939
"scripts": {
40-
"build": "node ./build-package.js",
41-
"build:examples-app": "pnpm run build && node ./build-example.js",
40+
"build": "ng build",
41+
"build:examples-app": "pnpm run build && ng build --project=example",
4242
"dev": "pnpm run build:examples-app && npx http-server ./example/dist/ -c-1 -o",
43-
"clean": "rimraf lib coverage dist .nyc_output 2> /dev/null",
43+
"clean": "rimraf lib coverage example/dist .nyc_output 2> /dev/null",
4444
"lint": "eslint .",
4545
"lint:fix": "eslint --fix .",
4646
"report": "nyc report --reporter=html",
4747
"doc": "typedoc --name 'JSON Forms Angular Material Renderers' --out docs src",
48-
"test-dbg": "node ./test-runner",
49-
"test": "node ./test-runner --single-run",
50-
"test-ci": "node ./test-runner --single-run",
51-
"test-cov": "node ./test-runner --coverage --single-run",
48+
"test-dbg": "ng test",
49+
"test": "ng test --watch=false",
50+
"test-ci": "ng test --watch=false --browsers ChromeHeadlessNoSandbox",
51+
"test-cov": "ng test --watch=false --code-coverage --browsers ChromeHeadlessNoSandbox",
5252
"e2e": "npm run e2e-update && npm run e2e-test",
5353
"e2e-test": "protractor ./test-config/protractor.conf.js",
5454
"e2e-update": "webdriver-manager update --standalone false --gecko false"
@@ -60,14 +60,14 @@
6060
]
6161
},
6262
"peerDependencies": {
63-
"@angular/animations": "^17.0.0 || ^18.0.0",
64-
"@angular/cdk": "^17.0.0 || ^18.0.0",
65-
"@angular/common": "^17.0.0 || ^18.0.0",
66-
"@angular/core": "^17.0.0 || ^18.0.0",
67-
"@angular/forms": "^17.0.0 || ^18.0.0",
68-
"@angular/material": "^17.0.0 || ^18.0.0",
69-
"@angular/platform-browser": "^17.0.0 || ^18.0.0",
70-
"@angular/router": "^17.0.0 || ^18.0.0",
63+
"@angular/animations": "^18.0.0 || ^19.0.0",
64+
"@angular/cdk": "^18.0.0 || ^19.0.0",
65+
"@angular/common": "^18.0.0 || ^19.0.0",
66+
"@angular/core": "^18.0.0 || ^19.0.0",
67+
"@angular/forms": "^18.0.0 || ^19.0.0",
68+
"@angular/material": "^18.0.0 || ^19.0.0",
69+
"@angular/platform-browser": "^18.0.0 || ^19.0.0",
70+
"@angular/router": "^18.0.0 || ^19.0.0",
7171
"@jsonforms/angular": "3.4.1",
7272
"@jsonforms/core": "3.4.1",
7373
"dayjs": "^1.11.10",
@@ -78,29 +78,29 @@
7878
"lodash": "^4.17.21"
7979
},
8080
"devDependencies": {
81-
"@angular-devkit/build-angular": "^17.0.0",
82-
"@angular-devkit/core": "^17.0.0",
83-
"@angular-eslint/eslint-plugin": "^17.0.0",
84-
"@angular-eslint/eslint-plugin-template": "^17.0.0",
85-
"@angular-eslint/schematics": "^17.0.0",
86-
"@angular-eslint/template-parser": "^17.0.0",
87-
"@angular/animations": "^17.0.0",
88-
"@angular/cdk": "^17.0.0",
89-
"@angular/common": "^17.0.0",
90-
"@angular/compiler": "^17.0.0",
91-
"@angular/compiler-cli": "^17.0.0",
92-
"@angular/core": "^17.0.0",
93-
"@angular/forms": "^17.0.0",
94-
"@angular/material": "^17.0.0",
95-
"@angular/platform-browser": "^17.0.0",
96-
"@angular/platform-browser-dynamic": "^17.0.0",
97-
"@angular/router": "^17.0.0",
81+
"@angular-devkit/build-angular": "^18.0.0",
82+
"@angular-devkit/core": "^18.0.0",
83+
"@angular-eslint/eslint-plugin": "^18.0.0",
84+
"@angular-eslint/eslint-plugin-template": "^18.0.0",
85+
"@angular-eslint/schematics": "^18.0.0",
86+
"@angular-eslint/template-parser": "^18.0.0",
87+
"@angular/animations": "^18.0.0",
88+
"@angular/cdk": "^18.0.0",
89+
"@angular/common": "^18.0.0",
90+
"@angular/compiler": "^18.0.0",
91+
"@angular/compiler-cli": "^18.0.0",
92+
"@angular/core": "^18.0.0",
93+
"@angular/forms": "^18.0.0",
94+
"@angular/material": "^18.0.0",
95+
"@angular/platform-browser": "^18.0.0",
96+
"@angular/platform-browser-dynamic": "^18.0.0",
97+
"@angular/router": "^18.0.0",
9898
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5",
9999
"@babel/plugin-proposal-optional-chaining": "^7.16.5",
100100
"@jsonforms/angular": "workspace:*",
101101
"@jsonforms/core": "workspace:*",
102102
"@jsonforms/examples": "workspace:*",
103-
"@ngtools/webpack": "^17.0.0",
103+
"@ngtools/webpack": "^18.0.0",
104104
"@types/jasmine": "~3.8.0",
105105
"@types/lodash": "4.14.149",
106106
"@types/node": "^18.19.4",
@@ -124,7 +124,7 @@
124124
"karma-jasmine-html-reporter": "^1.7.0",
125125
"karma-sourcemap-loader": "^0.3.8",
126126
"karma-webpack": "^5.0.0",
127-
"ng-packagr": "^17.0.0",
127+
"ng-packagr": "^18.0.0",
128128
"null-loader": "^0.1.1",
129129
"nyc": "^15.1.0",
130130
"prettier": "^2.8.4",
@@ -134,9 +134,9 @@
134134
"ts-loader": "^9.5.1",
135135
"tslib": "^2.5.0",
136136
"typedoc": "~0.25.3",
137-
"typescript": "~5.2.2",
137+
"typescript": "~5.5.0",
138138
"webpack": "^5.78.0",
139139
"yargs": "^17.7.2",
140-
"zone.js": "~0.14.0"
140+
"zone.js": "~0.14.10"
141141
}
142142
}

packages/angular-material/src/library/controls/autocomplete.renderer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ import { map, startWith } from 'rxjs/operators';
110110
`,
111111
],
112112
changeDetection: ChangeDetectionStrategy.OnPush,
113+
standalone: false,
113114
})
114115
export class AutocompleteControlRenderer
115116
extends JsonFormsControl

packages/angular-material/src/library/controls/boolean.renderer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import { isBooleanControl, RankedTester, rankWith } from '@jsonforms/core';
6565
`,
6666
],
6767
changeDetection: ChangeDetectionStrategy.OnPush,
68+
standalone: false,
6869
})
6970
export class BooleanControlRenderer extends JsonFormsControl {
7071
constructor(

0 commit comments

Comments
 (0)