Skip to content

Commit 36444ee

Browse files
authored
chore: upgrade to Nx 11 and Angular 11 (#77)
Closes #61
1 parent af8b7b7 commit 36444ee

Some content is hidden

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

41 files changed

+3942
-2837
lines changed

.circleci/config.yml

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ jobs:
5050
keys:
5151
- *cache_key
5252
- run: yarn affected:e2e --base=origin/master
53-
5453
workflows:
5554
version: 2
5655
build-test:

angular.json

+26-29
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"builder": "@nrwl/angular:package",
1212
"options": {
1313
"tsConfig": "libs/router/tsconfig.lib.json",
14-
"project": "libs/router/ng-package.json"
14+
"project": "libs/router/ng-package.json",
15+
"buildableProjectDepsInPackageJsonType": "dependencies"
1516
},
1617
"configurations": {
1718
"production": {
@@ -47,10 +48,10 @@
4748
"builder": "@nrwl/jest:jest",
4849
"options": {
4950
"jestConfig": "libs/router/jest.config.js",
50-
"tsConfig": "libs/router/tsconfig.spec.json",
51-
"passWithNoTests": true,
52-
"setupFile": "libs/router/src/test-setup.ts"
53-
}
51+
"setupFile": "libs/router/src/test-setup.ts",
52+
"passWithNoTests": true
53+
},
54+
"outputs": ["coverage/libs/router"]
5455
}
5556
},
5657
"schematics": {}
@@ -89,7 +90,6 @@
8990
"optimization": true,
9091
"outputHashing": "all",
9192
"sourceMap": false,
92-
"extractCss": true,
9393
"namedChunks": false,
9494
"extractLicenses": true,
9595
"vendorChunk": false,
@@ -107,7 +107,8 @@
107107
}
108108
]
109109
}
110-
}
110+
},
111+
"outputs": ["{options.outputPath}"]
111112
},
112113
"serve": {
113114
"builder": "@angular-devkit/build-angular:dev-server",
@@ -140,10 +141,9 @@
140141
"builder": "@nrwl/jest:jest",
141142
"options": {
142143
"jestConfig": "apps/example-app/jest.config.js",
143-
"tsConfig": "apps/example-app/tsconfig.spec.json",
144-
"passWithNoTests": true,
145-
"setupFile": "apps/example-app/src/test-setup.ts"
146-
}
144+
"passWithNoTests": true
145+
},
146+
"outputs": ["coverage/apps/example-app"]
147147
}
148148
}
149149
},
@@ -208,7 +208,6 @@
208208
"optimization": true,
209209
"outputHashing": "all",
210210
"sourceMap": false,
211-
"extractCss": true,
212211
"namedChunks": false,
213212
"extractLicenses": true,
214213
"vendorChunk": false,
@@ -226,7 +225,8 @@
226225
}
227226
]
228227
}
229-
}
228+
},
229+
"outputs": ["{options.outputPath}"]
230230
},
231231
"serve": {
232232
"builder": "@angular-devkit/build-angular:dev-server",
@@ -259,10 +259,9 @@
259259
"builder": "@nrwl/jest:jest",
260260
"options": {
261261
"jestConfig": "apps/recursive-routes/jest.config.js",
262-
"tsConfig": "apps/recursive-routes/tsconfig.spec.json",
263-
"passWithNoTests": true,
264-
"setupFile": "apps/recursive-routes/src/test-setup.ts"
265-
}
262+
"passWithNoTests": true
263+
},
264+
"outputs": ["coverage/apps/recursive-routes"]
266265
}
267266
}
268267
},
@@ -327,7 +326,6 @@
327326
"optimization": true,
328327
"outputHashing": "all",
329328
"sourceMap": false,
330-
"extractCss": true,
331329
"namedChunks": false,
332330
"extractLicenses": true,
333331
"vendorChunk": false,
@@ -345,7 +343,8 @@
345343
}
346344
]
347345
}
348-
}
346+
},
347+
"outputs": ["{options.outputPath}"]
349348
},
350349
"serve": {
351350
"builder": "@angular-devkit/build-angular:dev-server",
@@ -378,10 +377,9 @@
378377
"builder": "@nrwl/jest:jest",
379378
"options": {
380379
"jestConfig": "apps/responsive-app/jest.config.js",
381-
"tsConfig": "apps/responsive-app/tsconfig.spec.json",
382-
"passWithNoTests": true,
383-
"setupFile": "apps/responsive-app/src/test-setup.ts"
384-
}
380+
"passWithNoTests": true
381+
},
382+
"outputs": ["coverage/apps/responsive-app"]
385383
}
386384
}
387385
},
@@ -446,7 +444,6 @@
446444
"optimization": true,
447445
"outputHashing": "all",
448446
"sourceMap": false,
449-
"extractCss": true,
450447
"namedChunks": false,
451448
"extractLicenses": true,
452449
"vendorChunk": false,
@@ -464,7 +461,8 @@
464461
}
465462
]
466463
}
467-
}
464+
},
465+
"outputs": ["{options.outputPath}"]
468466
},
469467
"serve": {
470468
"builder": "@angular-devkit/build-angular:dev-server",
@@ -497,10 +495,9 @@
497495
"builder": "@nrwl/jest:jest",
498496
"options": {
499497
"jestConfig": "apps/route-restrictions/jest.config.js",
500-
"tsConfig": "apps/route-restrictions/tsconfig.spec.json",
501-
"passWithNoTests": true,
502-
"setupFile": "apps/route-restrictions/src/test-setup.ts"
503-
}
498+
"passWithNoTests": true
499+
},
500+
"outputs": ["coverage/apps/route-restrictions"]
504501
}
505502
}
506503
},

apps/example-app-e2e/src/integration/round-trip.spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ context('Full round trip', () => {
2424
});
2525

2626
it('shows a message when the credentials are wrong', () => {
27-
cy.get('[placeholder=Username]').type('wronguser');
28-
cy.get('[placeholder=Password]').type('supersafepassword');
27+
cy.get('[data-placeholder=Username]').type('wronguser');
28+
cy.get('[data-placeholder=Password]').type('supersafepassword');
2929
cy.get('[type="submit"]').click();
3030

3131
// TODO: uncomment once Applitools work properly
@@ -36,7 +36,7 @@ context('Full round trip', () => {
3636
});
3737

3838
it('is possible to login', () => {
39-
cy.get('[placeholder=Username]').clear().type('test');
39+
cy.get('[data-placeholder=Username]').clear().type('test');
4040
cy.get('[type="submit"]').click();
4141
});
4242

@@ -47,7 +47,7 @@ context('Full round trip', () => {
4747

4848
// TODO: uncomment once Applitools work properly
4949
// (cy as any).eyesCheckWindow('is possible to search for books');
50-
cy.get('[placeholder="Search for a book"]').type('The Alchemist');
50+
cy.get('[data-placeholder="Search for a book"]').type('The Alchemist');
5151
cy.get('bc-book-preview').its('length').should('be.gte', 1);
5252
});
5353

@@ -89,7 +89,7 @@ context('Full round trip', () => {
8989

9090
// TODO: uncomment once Applitools work properly
9191
// (cy as any).eyesCheckWindow('is possible to sign out');
92-
cy.get('[placeholder=Username]').should('exist');
93-
cy.get('[placeholder=Password]').should('exist');
92+
cy.get('[data-placeholder=Username]').should('exist');
93+
cy.get('[data-placeholder=Password]').should('exist');
9494
});
9595
});

apps/example-app-e2e/tsconfig.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
44
"types": ["cypress", "node"]
55
},
6-
"include": ["**/*.ts", "**/*.js"]
6+
"include": [],
7+
"files": [],
8+
"references": [
9+
{
10+
"path": "./tsconfig.e2e.json"
11+
}
12+
]
713
}

apps/example-app/jest.config.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
module.exports = {
2-
name: 'example-app',
3-
preset: '../../jest.config.js',
2+
preset: '../../jest.preset.js',
43
coverageDirectory: '../../coverage/apps/example-app',
54
snapshotSerializers: [
65
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
76
'jest-preset-angular/build/AngularSnapshotSerializer.js',
87
'jest-preset-angular/build/HTMLCommentSerializer.js',
98
],
9+
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
10+
globals: { 'ts-jest': { tsConfig: '<rootDir>/tsconfig.spec.json' } },
11+
displayName: 'example-app',
1012
};

apps/example-app/src/app/books/containers/selected-book-page.component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export class SelectedBookPageComponent {
2525
isSelectedBookInCollection$: Observable<boolean>;
2626

2727
constructor(private store: Store<fromBooks.State>) {
28-
this.book$ = store.pipe(select(fromBooks.selectSelectedBook)) as Observable<
29-
Book
30-
>;
28+
this.book$ = store.pipe(
29+
select(fromBooks.selectSelectedBook)
30+
) as Observable<Book>;
3131
this.isSelectedBookInCollection$ = store.pipe(
3232
select(fromBooks.isSelectedBookInCollection)
3333
);

apps/example-app/src/app/core/containers/app.component.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ import { LayoutActions } from '@example-app/core/actions';
4747
Sign Out
4848
</bc-nav-item>
4949
</bc-sidenav>
50-
<bc-toolbar (openMenu)="openSidenav()">
51-
Book Collection
52-
</bc-toolbar>
50+
<bc-toolbar (openMenu)="openSidenav()"> Book Collection </bc-toolbar>
5351
5452
<router>
5553
<route path="/books" [exact]="false" [load]="components.books"></route>

apps/example-app/src/polyfills.ts

-2
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,3 @@
1717

1818
// import 'core-js/es7/reflect';
1919
import 'zone.js/dist/zone';
20-
21-
import 'hammerjs';

apps/example-app/tsconfig.editor.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["**/*.ts"],
4+
"compilerOptions": {
5+
"types": ["jest", "node"]
6+
}
7+
}

apps/example-app/tsconfig.json

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
44
"types": ["node", "jest"]
5-
}
5+
},
6+
"files": [],
7+
"include": [],
8+
"references": [
9+
{
10+
"path": "./tsconfig.app.json"
11+
},
12+
{
13+
"path": "./tsconfig.spec.json"
14+
},
15+
{
16+
"path": "./tsconfig.editor.json"
17+
}
18+
]
619
}
+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
44
"types": ["cypress", "node"]
55
},
6-
"include": ["**/*.ts", "**/*.js"]
6+
"include": [],
7+
"files": [],
8+
"references": [
9+
{
10+
"path": "./tsconfig.e2e.json"
11+
}
12+
]
713
}

apps/recursive-routes/jest.config.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
module.exports = {
2-
name: 'recursive-routes',
3-
preset: '../../jest.config.js',
2+
preset: '../../jest.preset.js',
43
coverageDirectory: '../../coverage/apps/recursive-routes',
54
snapshotSerializers: [
65
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
76
'jest-preset-angular/build/AngularSnapshotSerializer.js',
87
'jest-preset-angular/build/HTMLCommentSerializer.js',
98
],
9+
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
10+
globals: {
11+
'ts-jest': {
12+
tsConfig: '<rootDir>/tsconfig.spec.json',
13+
stringifyContentPathRegex: '\\.(html|svg)$',
14+
astTransformers: [
15+
'jest-preset-angular/build/InlineFilesTransformer',
16+
'jest-preset-angular/build/StripStylesTransformer',
17+
],
18+
},
19+
},
20+
displayName: 'recursive-routes',
1021
};

apps/recursive-routes/src/app/app.component.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
<mat-toolbar color="primary">
2-
Recursive routes
3-
</mat-toolbar>
1+
<mat-toolbar color="primary"> Recursive routes </mat-toolbar>
42

53
<main>
64
<router>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["**/*.ts"],
4+
"compilerOptions": {
5+
"types": ["jest", "node"]
6+
}
7+
}

apps/recursive-routes/tsconfig.json

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
44
"types": ["node", "jest"]
5-
}
5+
},
6+
"files": [],
7+
"include": [],
8+
"references": [
9+
{
10+
"path": "./tsconfig.app.json"
11+
},
12+
{
13+
"path": "./tsconfig.spec.json"
14+
},
15+
{
16+
"path": "./tsconfig.editor.json"
17+
}
18+
]
619
}

apps/responsive-app-e2e/tsconfig.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
2-
"extends": "../../tsconfig.json",
2+
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
44
"types": ["cypress", "node"]
55
},
6-
"include": ["**/*.ts", "**/*.js"]
6+
"include": [],
7+
"files": [],
8+
"references": [
9+
{
10+
"path": "./tsconfig.e2e.json"
11+
}
12+
]
713
}

0 commit comments

Comments
 (0)