Skip to content

Commit fdc3f1d

Browse files
committed
feat: add Angular 18-21 multi-version compat testing
- Add compat test configs in core/compat/{a18,a19,a20,latest}/ - Each folder has version-specific package.json and angular.json - Refactor test-and-build-for-all.sh: function with node version param, version selector (./test-and-build-for-all.sh 19), restore-to-latest - Add compat job to GitHub Actions testing Angular 18, 19, 20, 21 - Update package-latest.json to Angular 21 - Drop Angular 16 and 17 (incompatible TypeScript)
1 parent 99a7c6f commit fdc3f1d

12 files changed

Lines changed: 699 additions & 38 deletions

File tree

.github/workflows/ngx-translate-test.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
15+
name: "Latest (Node ${{ matrix.node-version }})"
1516

1617
strategy:
1718
matrix:
@@ -30,3 +31,39 @@ jobs:
3031
- run: pnpm run lint
3132
- run: pnpm run build-all
3233
- run: pnpm run test-ci
34+
35+
compat:
36+
runs-on: ubuntu-latest
37+
name: "Angular ${{ matrix.angular-version }}"
38+
39+
strategy:
40+
matrix:
41+
include:
42+
- angular-version: 18
43+
node-version: 18.x
44+
config-dir: compat/a18
45+
- angular-version: 19
46+
node-version: 18.x
47+
config-dir: compat/a19
48+
- angular-version: 20
49+
node-version: 20.x
50+
config-dir: compat/a20
51+
- angular-version: 21
52+
node-version: 22.x
53+
config-dir: compat/latest
54+
55+
steps:
56+
- uses: actions/checkout@v4
57+
- name: Install pnpm
58+
uses: pnpm/action-setup@v4
59+
- name: Use Node.js ${{ matrix.node-version }}
60+
uses: actions/setup-node@v4
61+
with:
62+
node-version: ${{ matrix.node-version }}
63+
- name: Use compat config
64+
run: |
65+
cp ${{ matrix.config-dir }}/package.json package.json
66+
cp ${{ matrix.config-dir }}/angular.json angular.json
67+
- run: pnpm install --no-frozen-lockfile
68+
- run: pnpm run build-all
69+
- run: pnpm run test-ci

compat/a16/angular.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"ngx-translate": {
7+
"projectType": "library",
8+
"root": "projects/ngx-translate",
9+
"sourceRoot": "projects/ngx-translate/src",
10+
"prefix": "lib",
11+
"architect": {
12+
"build": {
13+
"builder": "@angular-devkit/build-angular:ng-packagr",
14+
"options": {
15+
"project": "projects/ngx-translate/ng-package.json"
16+
},
17+
"configurations": {
18+
"production": {
19+
"tsConfig": "projects/ngx-translate/tsconfig.lib.prod.json"
20+
},
21+
"development": {
22+
"tsConfig": "projects/ngx-translate/tsconfig.lib.json"
23+
}
24+
},
25+
"defaultConfiguration": "production"
26+
},
27+
"test": {
28+
"builder": "@angular-devkit/build-angular:karma",
29+
"options": {
30+
"tsConfig": "./tsconfig.spec.json",
31+
"polyfills": ["zone.js", "zone.js/testing"]
32+
}
33+
}
34+
}
35+
},
36+
"http-loader": {
37+
"projectType": "library",
38+
"root": "projects/http-loader",
39+
"sourceRoot": "projects/http-loader/src",
40+
"prefix": "lib",
41+
"architect": {
42+
"build": {
43+
"builder": "@angular-devkit/build-angular:ng-packagr",
44+
"options": {
45+
"project": "projects/http-loader/ng-package.json"
46+
},
47+
"configurations": {
48+
"production": {
49+
"tsConfig": "projects/http-loader/tsconfig.lib.prod.json"
50+
},
51+
"development": {
52+
"tsConfig": "projects/http-loader/tsconfig.lib.json"
53+
}
54+
},
55+
"defaultConfiguration": "production"
56+
},
57+
"test": {
58+
"builder": "@angular-devkit/build-angular:karma",
59+
"options": {
60+
"tsConfig": "./tsconfig.spec.json",
61+
"polyfills": ["zone.js", "zone.js/testing"]
62+
}
63+
}
64+
}
65+
}
66+
}
67+
}

compat/a18/angular.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"ngx-translate": {
7+
"projectType": "library",
8+
"root": "projects/ngx-translate",
9+
"sourceRoot": "projects/ngx-translate/src",
10+
"prefix": "lib",
11+
"architect": {
12+
"build": {
13+
"builder": "@angular-devkit/build-angular:ng-packagr",
14+
"options": {
15+
"project": "projects/ngx-translate/ng-package.json"
16+
},
17+
"configurations": {
18+
"production": {
19+
"tsConfig": "projects/ngx-translate/tsconfig.lib.prod.json"
20+
},
21+
"development": {
22+
"tsConfig": "projects/ngx-translate/tsconfig.lib.json"
23+
}
24+
},
25+
"defaultConfiguration": "production"
26+
},
27+
"test": {
28+
"builder": "@angular-devkit/build-angular:karma",
29+
"options": {
30+
"tsConfig": "./tsconfig.spec.json",
31+
"polyfills": ["zone.js", "zone.js/testing"]
32+
}
33+
}
34+
}
35+
},
36+
"http-loader": {
37+
"projectType": "library",
38+
"root": "projects/http-loader",
39+
"sourceRoot": "projects/http-loader/src",
40+
"prefix": "lib",
41+
"architect": {
42+
"build": {
43+
"builder": "@angular-devkit/build-angular:ng-packagr",
44+
"options": {
45+
"project": "projects/http-loader/ng-package.json"
46+
},
47+
"configurations": {
48+
"production": {
49+
"tsConfig": "projects/http-loader/tsconfig.lib.prod.json"
50+
},
51+
"development": {
52+
"tsConfig": "projects/http-loader/tsconfig.lib.json"
53+
}
54+
},
55+
"defaultConfiguration": "production"
56+
},
57+
"test": {
58+
"builder": "@angular-devkit/build-angular:karma",
59+
"options": {
60+
"tsConfig": "./tsconfig.spec.json",
61+
"polyfills": ["zone.js", "zone.js/testing"]
62+
}
63+
}
64+
}
65+
}
66+
}
67+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"build-all": "ng build ngx-translate && ng build http-loader",
99
"watch": "ng build --watch --configuration development",
1010
"test": "ng test --code-coverage ",
11-
"test-ci": "ng test --watch=false --browsers=ChromeHeadless --reporters=mocha",
12-
"coverage": "ng test ngx-translate --code-coverage --watch=false --browsers=ChromeHeadless --reporters=mocha,coverage",
11+
"test-ci": "ng test --watch=false --browsers=ChromeHeadless",
12+
"coverage": "ng test ngx-translate --code-coverage --watch=false --browsers=ChromeHeadless",
1313
"lint": "ng lint"
1414
},
1515
"private": true,

compat/a19/angular.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"ngx-translate": {
7+
"projectType": "library",
8+
"root": "projects/ngx-translate",
9+
"sourceRoot": "projects/ngx-translate/src",
10+
"prefix": "lib",
11+
"architect": {
12+
"build": {
13+
"builder": "@angular-devkit/build-angular:ng-packagr",
14+
"options": {
15+
"project": "projects/ngx-translate/ng-package.json"
16+
},
17+
"configurations": {
18+
"production": {
19+
"tsConfig": "projects/ngx-translate/tsconfig.lib.prod.json"
20+
},
21+
"development": {
22+
"tsConfig": "projects/ngx-translate/tsconfig.lib.json"
23+
}
24+
},
25+
"defaultConfiguration": "production"
26+
},
27+
"test": {
28+
"builder": "@angular-devkit/build-angular:karma",
29+
"options": {
30+
"tsConfig": "./tsconfig.spec.json",
31+
"polyfills": ["zone.js", "zone.js/testing"]
32+
}
33+
}
34+
}
35+
},
36+
"http-loader": {
37+
"projectType": "library",
38+
"root": "projects/http-loader",
39+
"sourceRoot": "projects/http-loader/src",
40+
"prefix": "lib",
41+
"architect": {
42+
"build": {
43+
"builder": "@angular-devkit/build-angular:ng-packagr",
44+
"options": {
45+
"project": "projects/http-loader/ng-package.json"
46+
},
47+
"configurations": {
48+
"production": {
49+
"tsConfig": "projects/http-loader/tsconfig.lib.prod.json"
50+
},
51+
"development": {
52+
"tsConfig": "projects/http-loader/tsconfig.lib.json"
53+
}
54+
},
55+
"defaultConfiguration": "production"
56+
},
57+
"test": {
58+
"builder": "@angular-devkit/build-angular:karma",
59+
"options": {
60+
"tsConfig": "./tsconfig.spec.json",
61+
"polyfills": ["zone.js", "zone.js/testing"]
62+
}
63+
}
64+
}
65+
}
66+
}
67+
}
Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,30 @@
88
"build-all": "ng build ngx-translate && ng build http-loader",
99
"watch": "ng build --watch --configuration development",
1010
"test": "ng test --code-coverage ",
11-
"test-ci": "ng test --watch=false --browsers=ChromeHeadless --reporters=mocha",
12-
"coverage": "ng test ngx-translate --code-coverage --watch=false --browsers=ChromeHeadless --reporters=mocha,coverage",
11+
"test-ci": "ng test --watch=false --browsers=ChromeHeadless",
12+
"coverage": "ng test ngx-translate --code-coverage --watch=false --browsers=ChromeHeadless",
1313
"lint": "ng lint"
1414
},
1515
"private": true,
1616
"dependencies": {
17-
"@angular/animations": "^17",
18-
"@angular/common": "^17",
19-
"@angular/compiler": "^17",
20-
"@angular/core": "^17",
21-
"@angular/forms": "^17",
22-
"@angular/platform-browser": "^17",
23-
"@angular/platform-browser-dynamic": "^17",
24-
"@angular/router": "^17",
17+
"@angular/animations": "^19",
18+
"@angular/common": "^19",
19+
"@angular/compiler": "^19",
20+
"@angular/core": "^19",
21+
"@angular/forms": "^19",
22+
"@angular/platform-browser": "^19",
23+
"@angular/platform-browser-dynamic": "^19",
24+
"@angular/router": "^19",
2525
"rxjs": "~7.8.0",
26-
"tslib": "^2.3.0"
26+
"tslib": "^2.3.0",
27+
"zone.js": "~0.15.0"
2728
},
2829
"devDependencies": {
29-
"@angular-devkit/build-angular": "^17",
30-
"@angular/cli": "^17",
31-
"@angular/compiler-cli": "^17",
30+
"@angular-devkit/build-angular": "^19",
31+
"@angular/cli": "^19",
32+
"@angular/compiler-cli": "^19",
3233
"@types/jasmine": "~5.1.0",
34+
"angular-eslint": "^19",
3335
"eslint": "^9.9.1",
3436
"jasmine-core": "~5.2.0",
3537
"karma": "~6.4.0",
@@ -38,8 +40,8 @@
3840
"karma-jasmine": "~5.1.0",
3941
"karma-jasmine-html-reporter": "~2.1.0",
4042
"karma-mocha-reporter": "^2.2.5",
41-
"ng-packagr": "^17",
43+
"ng-packagr": "^19",
44+
"typescript": "~5.7.0",
4245
"typescript-eslint": "8.2.0"
43-
},
44-
"packageManager": "pnpm@9.10.0+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c"
46+
}
4547
}

0 commit comments

Comments
 (0)