Skip to content

Commit 3a4c7ee

Browse files
committed
fear(core): add support for Angular v13
Fixes #1345 Fixes ngx-translate/http-loader#101 Fixes ngx-translate/http-loader#100
1 parent 34a5259 commit 3a4c7ee

35 files changed

+25774
-14036
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/dist
55
/tmp
66
/out-tsc
7+
/.angular
78

89
# dependencies
910
/node_modules

FIREBASE_EXAMPLE.md

-65
This file was deleted.

README.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,17 @@ npm install @ngx-translate/core --save
4747

4848
Choose the version corresponding to your Angular version:
4949

50-
Angular | @ngx-translate/core | @ngx-translate/http-loader
51-
----------- | ------------------- | --------------------------
52-
10/11/12 | 13.x+ | 6.x+
53-
9 | 12.x+ | 5.x+
54-
8 | 12.x+ | 4.x+
55-
7 | 11.x+ | 4.x+
56-
6 | 10.x | 3.x
57-
5 | 8.x to 9.x | 1.x to 2.x
58-
4.3 | 7.x or less | 1.x to 2.x
59-
2 to 4.2.x | 7.x or less | 0.x
50+
Angular | @ngx-translate/core | @ngx-translate/http-loader
51+
------------- | ------------------- | --------------------------
52+
13 (ivy only) | 14.x+ | 7.x+
53+
10/11/12/13 | 13.x+ | 6.x+
54+
9 | 12.x+ | 5.x+
55+
8 | 12.x+ | 4.x+
56+
7 | 11.x+ | 4.x+
57+
6 | 10.x | 3.x
58+
5 | 8.x to 9.x | 1.x to 2.x
59+
4.3 | 7.x or less | 1.x to 2.x
60+
2 to 4.2.x | 7.x or less | 0.x
6061

6162
---
6263

angular.json

+41-14
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,63 @@
44
"newProjectRoot": "projects",
55
"projects": {
66
"@ngx-translate/core": {
7+
"projectType": "library",
78
"root": "projects/ngx-translate/core",
89
"sourceRoot": "projects/ngx-translate/core/src",
9-
"projectType": "library",
1010
"prefix": "lib",
1111
"architect": {
1212
"build": {
13-
"builder": "@angular-devkit/build-ng-packagr:build",
13+
"builder": "@angular-devkit/build-angular:ng-packagr",
1414
"options": {
15-
"tsConfig": "projects/ngx-translate/core/tsconfig.lib.json",
1615
"project": "projects/ngx-translate/core/ng-package.json"
17-
}
16+
},
17+
"configurations": {
18+
"production": {
19+
"tsConfig": "projects/ngx-translate/core/tsconfig.lib.prod.json"
20+
},
21+
"development": {
22+
"tsConfig": "projects/ngx-translate/core/tsconfig.lib.json"
23+
}
24+
},
25+
"defaultConfiguration": "production"
1826
},
1927
"test": {
2028
"builder": "@angular-devkit/build-angular:karma",
2129
"options": {
22-
"main": "projects/ngx-translate/core/test.ts",
30+
"main": "projects/ngx-translate/core/src/test.ts",
2331
"tsConfig": "projects/ngx-translate/core/tsconfig.spec.json",
2432
"karmaConfig": "projects/ngx-translate/core/karma.conf.js"
2533
}
34+
}
35+
}
36+
},
37+
"@ngx-translate/http-loader": {
38+
"projectType": "library",
39+
"root": "projects/ngx-translate/http-loader",
40+
"sourceRoot": "projects/ngx-translate/http-loader/src",
41+
"prefix": "lib",
42+
"architect": {
43+
"build": {
44+
"builder": "@angular-devkit/build-angular:ng-packagr",
45+
"options": {
46+
"project": "projects/ngx-translate/http-loader/ng-package.json"
47+
},
48+
"configurations": {
49+
"production": {
50+
"tsConfig": "projects/ngx-translate/http-loader/tsconfig.lib.prod.json"
51+
},
52+
"development": {
53+
"tsConfig": "projects/ngx-translate/http-loader/tsconfig.lib.json"
54+
}
55+
},
56+
"defaultConfiguration": "production"
2657
},
27-
"lint": {
28-
"builder": "@angular-devkit/build-angular:tslint",
58+
"test": {
59+
"builder": "@angular-devkit/build-angular:karma",
2960
"options": {
30-
"tsConfig": [
31-
"projects/ngx-translate/core/tsconfig.lib.json",
32-
"projects/ngx-translate/core/tsconfig.spec.json"
33-
],
34-
"exclude": [
35-
"**/node_modules/**"
36-
]
61+
"main": "projects/ngx-translate/http-loader/src/test.ts",
62+
"tsConfig": "projects/ngx-translate/http-loader/tsconfig.spec.json",
63+
"karmaConfig": "projects/ngx-translate/http-loader/karma.conf.js"
3764
}
3865
}
3966
}

jest-global-mocks.ts

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Object.defineProperty(window, 'CSS', { value: null });
2+
Object.defineProperty(document, 'doctype', {
3+
value: '<!DOCTYPE html>',
4+
});
5+
Object.defineProperty(window, 'getComputedStyle', {
6+
value: () => {
7+
return {
8+
display: 'none',
9+
appearance: ['-webkit-appearance'],
10+
};
11+
},
12+
});
13+
/**
14+
* ISSUE: https://github.com/angular/material2/issues/7101
15+
* Workaround for JSDOM missing transform property
16+
*/
17+
Object.defineProperty(document.body.style, 'transform', {
18+
value: () => {
19+
return {
20+
enumerable: true,
21+
configurable: true,
22+
};
23+
},
24+
});

jest.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require('jest-preset-angular/ngcc-jest-processor');
2+
const { pathsToModuleNameMapper } = require('ts-jest/utils');
3+
const { paths } = require('./tsconfig.json').compilerOptions;
4+
5+
/** @type {import('@jest/types').Config.InitialOptions} */
6+
module.exports = {
7+
preset: 'jest-preset-angular',
8+
moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: '<rootDir>' }),
9+
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
10+
};

0 commit comments

Comments
 (0)