Skip to content

Commit 12184a8

Browse files
feat: upgrade to Angular 11 (#168)
1 parent e9e6b14 commit 12184a8

18 files changed

+13714
-116
lines changed

angular.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"optimization": true,
4141
"outputHashing": "all",
4242
"sourceMap": false,
43-
"extractCss": true,
4443
"namedChunks": false,
4544
"aot": true,
4645
"extractLicenses": true,
@@ -90,7 +89,7 @@
9089
"prefix": "lib",
9190
"architect": {
9291
"build-package": {
93-
"builder": "@angular-devkit/build-ng-packagr:build",
92+
"builder": "@angular-devkit/build-angular:ng-packagr",
9493
"options": {
9594
"tsConfig": "projects/testing-library/tsconfig.lib.json",
9695
"project": "projects/testing-library/ng-package.json"
@@ -146,7 +145,7 @@
146145
"prefix": "lib",
147146
"architect": {
148147
"build-package": {
149-
"builder": "@angular-devkit/build-ng-packagr:build",
148+
"builder": "@angular-devkit/build-angular:ng-packagr",
150149
"options": {
151150
"tsConfig": "projects/jest-utils/tsconfig.lib.json",
152151
"project": "projects/jest-utils/ng-package.json"

apps/example-app/app/app-routing.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const routes: Routes = [
9595
];
9696

9797
@NgModule({
98-
imports: [RouterModule.forRoot(routes)],
98+
imports: [RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' })],
9999
exports: [RouterModule],
100100
})
101101
export class AppRoutingModule {}

apps/example-app/jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ module.exports = {
44
name: 'Example',
55
color: 'blue',
66
},
7-
preset: '../../jest.config.js',
7+
preset: '../../jest.preset.js',
88
};

apps/example-app/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../tsconfig.base.json",
2+
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/app",
55
"types": [],

apps/example-app/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../tsconfig.base.json",
2+
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"module": "commonjs",
55
"types": ["node", "jest"]

jest.config.js

+1-25
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
11
module.exports = {
2-
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
3-
transform: {
4-
'^.+\\.(ts|js|html)$': 'ts-jest',
5-
},
6-
resolver: '@nrwl/jest/plugins/resolver',
7-
moduleFileExtensions: ['ts', 'js', 'html'],
8-
coverageReporters: ['html'],
9-
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
10-
snapshotSerializers: [
11-
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
12-
'jest-preset-angular/build/AngularSnapshotSerializer.js',
13-
'jest-preset-angular/build/HTMLCommentSerializer.js',
14-
],
15-
globals: {
16-
'ts-jest': {
17-
tsconfig: '<rootDir>/tsconfig.spec.json',
18-
stringifyContentPathRegex: '\\.(html|svg)$',
19-
astTransformers: {
20-
before: [
21-
'jest-preset-angular/build/InlineFilesTransformer',
22-
'jest-preset-angular/build/StripStylesTransformer',
23-
]
24-
},
25-
},
26-
},
2+
projects: ['<rootDir>/', '<rootDir>/projects/testing-library', '<rootDir>/projects/jest-utils'],
273
};

jest.preset.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const nxPreset = require('@nrwl/jest/preset');
2+
module.exports = {
3+
...nxPreset,
4+
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
5+
transform: {
6+
'^.+\\.(ts|js|html)$': 'ts-jest',
7+
},
8+
resolver: '@nrwl/jest/plugins/resolver',
9+
moduleFileExtensions: ['ts', 'js', 'html'],
10+
coverageReporters: ['html'],
11+
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
12+
snapshotSerializers: [
13+
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
14+
'jest-preset-angular/build/AngularSnapshotSerializer.js',
15+
'jest-preset-angular/build/HTMLCommentSerializer.js',
16+
],
17+
globals: {
18+
'ts-jest': {
19+
tsconfig: '<rootDir>/tsconfig.spec.json',
20+
stringifyContentPathRegex: '\\.(html|svg)$',
21+
astTransformers: {
22+
before: [
23+
'jest-preset-angular/build/InlineFilesTransformer',
24+
'jest-preset-angular/build/StripStylesTransformer',
25+
],
26+
},
27+
},
28+
},
29+
};

package.json

+25-25
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
"semantic-release": "semantic-release"
2121
},
2222
"dependencies": {
23-
"@angular/animations": "^10.0.0",
24-
"@angular/cdk": "^10.0.0",
25-
"@angular/common": "^10.0.0",
26-
"@angular/compiler": "^10.0.0",
27-
"@angular/core": "^10.0.0",
28-
"@angular/forms": "^10.0.0",
29-
"@angular/material": "^10.0.0",
30-
"@angular/platform-browser": "^10.0.0",
31-
"@angular/platform-browser-dynamic": "^10.0.0",
32-
"@angular/router": "^10.0.0",
33-
"@ngrx/store": "^9.2.0",
34-
"@nrwl/angular": "^10.0.0",
23+
"@angular/animations": "^11.0.0",
24+
"@angular/cdk": "^11.0.0",
25+
"@angular/common": "^11.0.0",
26+
"@angular/compiler": "^11.0.0",
27+
"@angular/core": "^11.0.0",
28+
"@angular/forms": "^11.0.0",
29+
"@angular/material": "^11.0.0",
30+
"@angular/platform-browser": "^11.0.0",
31+
"@angular/platform-browser-dynamic": "^11.0.0",
32+
"@angular/router": "^11.0.0",
33+
"@ngrx/store": "^10.0.1",
34+
"@nrwl/angular": "^10.3.3",
3535
"@nrwl/nx-cloud": "^10.0.0",
3636
"@phenomnomnominal/tsquery": "^4.1.1",
3737
"@testing-library/dom": "^7.24.1",
@@ -43,30 +43,30 @@
4343
"zone.js": "~0.10.3"
4444
},
4545
"devDependencies": {
46-
"@angular-devkit/build-angular": "~0.1000.0",
47-
"@angular-devkit/build-ng-packagr": "~0.1000.0",
48-
"@angular/cli": "~10.0.0",
49-
"@angular/compiler-cli": "^10.0.0",
50-
"@angular/language-service": "^10.0.0",
51-
"@nrwl/jest": "^10.0.0",
52-
"@nrwl/node": "^10.0.0",
53-
"@nrwl/nx-plugin": "^10.0.0",
54-
"@nrwl/workspace": "^10.0.0",
46+
"@angular-devkit/build-angular": "~0.1100.0",
47+
"@angular/cli": "~11.0.0",
48+
"@angular/compiler-cli": "^11.0.0",
49+
"@angular/language-service": "^11.0.0",
50+
"@nrwl/cli": "10.3.3",
51+
"@nrwl/jest": "^10.3.3",
52+
"@nrwl/node": "^10.3.3",
53+
"@nrwl/nx-plugin": "^10.3.3",
54+
"@nrwl/workspace": "^10.3.3",
5555
"@testing-library/jest-dom": "^5.11.0",
5656
"@types/jest": "~26.0.3",
5757
"@types/node": "^14.0.14",
5858
"codelyzer": "^5.2.2",
5959
"cpy-cli": "^3.1.1",
6060
"husky": "^4.2.5",
6161
"jest": "^26.1.0",
62-
"jest-preset-angular": "^8.2.1",
62+
"jest-preset-angular": "8.3.1",
6363
"lint-staged": "^10.2.11",
64-
"ng-packagr": "^10.0.0",
64+
"ng-packagr": "^11.0.1",
6565
"prettier": "^2.0.5",
6666
"rimraf": "^3.0.2",
6767
"semantic-release": "^17.1.1",
68-
"ts-jest": "^26.1.1",
68+
"ts-jest": "26.4.0",
6969
"ts-node": "~8.10.2",
70-
"typescript": "~3.9.5"
70+
"typescript": "~4.0.5"
7171
}
7272
}

projects/jest-utils/jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ module.exports = {
44
name: 'JEST UTILS',
55
color: 'magenta',
66
},
7-
preset: '../../jest.config.js',
7+
preset: '../../jest.preset.js',
88
};

projects/jest-utils/tsconfig.lib.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"extends": "../../tsconfig.base.json",
2+
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "../../out-tsc/lib",
55
"target": "es2015",
6+
"declarationMap": false,
67
"module": "es2015",
78
"moduleResolution": "node",
89
"declaration": true,

projects/jest-utils/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../tsconfig.base.json",
2+
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"module": "commonjs",
55
"types": ["node", "jest"]

projects/testing-library/jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ module.exports = {
44
name: 'ATL',
55
color: 'magenta',
66
},
7-
preset: '../../jest.config.js',
7+
preset: '../../jest.preset.js',
88
};

projects/testing-library/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
},
2323
"homepage": "https://github.com/testing-library/angular-testing-library#readme",
2424
"peerDependencies": {
25-
"@angular/common": "^10.0.0",
26-
"@angular/platform-browser": "^10.0.0",
27-
"@angular/animations": "^10.0.0",
28-
"@angular/router": "^10.0.0",
29-
"@angular/core": "^10.0.0"
25+
"@angular/common": ">= 10.0.0 < 12",
26+
"@angular/platform-browser": ">= 10.0.0 < 12",
27+
"@angular/animations": ">= 10.0.0 < 12",
28+
"@angular/router": ">= 10.0.0 < 12",
29+
"@angular/core": ">= 10.0.0 < 12"
3030
},
3131
"dependencies": {
3232
"@testing-library/dom": "^7.18.1",

projects/testing-library/tsconfig.lib.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"extends": "../../tsconfig.base.json",
2+
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "../../out-tsc/lib",
5+
"declarationMap": false,
56
"target": "es2015",
67
"module": "ES2015",
78
"moduleResolution": "node",

projects/testing-library/tsconfig.spec.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../tsconfig.base.json",
2+
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"module": "commonjs",
55
"types": ["node", "jest"]

tsconfig.base.json

-21
This file was deleted.

tsconfig.json

+19-27
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
1-
/*
2-
This is a "Solution Style" tsconfig.json file, and is used by editors and TypeScript’s language server to improve development experience.
3-
It is not intended to be used to perform a compilation.
4-
5-
To learn more about this file see: https://angular.io/config/solution-tsconfig.
6-
*/
71
{
8-
"files": [],
9-
"references": [
10-
{
11-
"path": "./apps/example-app/tsconfig.json"
12-
},
13-
{
14-
"path": "./apps/example-app/tsconfig.spec.json"
15-
},
16-
{
17-
"path": "./projects/testing-library/tsconfig.lib.json"
18-
},
19-
{
20-
"path": "./projects/testing-library/tsconfig.spec.json"
21-
},
22-
{
23-
"path": "./projects/jest-utils/tsconfig.lib.json"
24-
},
25-
{
26-
"path": "./projects/jest-utils/tsconfig.spec.json"
2+
"compileOnSave": false,
3+
"compilerOptions": {
4+
"baseUrl": "./",
5+
"importHelpers": true,
6+
"module": "esnext",
7+
"outDir": "./dist/out-tsc",
8+
"sourceMap": true,
9+
"declaration": false,
10+
"moduleResolution": "node",
11+
"emitDecoratorMetadata": true,
12+
"experimentalDecorators": true,
13+
"target": "es2015",
14+
"typeRoots": ["node_modules/@types"],
15+
"lib": ["es2017", "dom"],
16+
"paths": {
17+
"@testing-library/angular": ["projects/testing-library"],
18+
"@testing-library/angular/jest-utils": ["projects/jest-utils"]
2719
}
28-
]
29-
}
20+
}
21+
}

0 commit comments

Comments
 (0)