Skip to content

Commit 1ed9e5d

Browse files
authored
Feat(Angular-universal-ssr) upgrade to ang15 (#2775)
* update readme * Feat(Angular-universal-ssr): upgrade to 15 * fix client lazy components creation. * fix test run
1 parent c00ec5b commit 1ed9e5d

38 files changed

+23915
-200
lines changed

angular-universal-ssr/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ Run `yarn start`. This will build and serve both `client-app`, `host-app`, on
99
ports `4000`, `5000`, respectively.
1010

1111
- [localhost:4000](http://localhost:4000/) (CLIENT_APP)
12-
- [localhost:5000](http://localhost:5000/) (HOST_APP)
12+
- [localhost:3000](http://localhost:3000/) (HOST_APP)
1313

1414
# Running Cypress E2E Tests
1515

1616
To run tests in interactive mode, run `npm run cypress:debug` from the root directory of the project. It will open Cypress Test Runner and allow to run tests in interactive mode. [More info about "How to run tests"](../../cypress/README.md#how-to-run-tests)
1717

1818
To build app and run test in headless mode, run `yarn e2e:ci`. It will build app and run tests for this workspace in headless mode. If tets failed cypress will create `cypress` directory in sample root folder with screenshots and videos.
1919

20-
["Best Practices, Rules amd more interesting information here](../../cypress/README.md)
20+
["Best Practices, Rules amd more interesting information here](../../cypress/README.md)

angular-universal-ssr/client-app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ speed-measure-plugin*.json
3232
.history/*
3333

3434
# misc
35+
/.angular/cache
3536
/.sass-cache
3637
/connect.lock
3738
/coverage

angular-universal-ssr/client-app/angular.json

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
33
"version": 1,
44
"cli": {
5-
"packageManager": "yarn"
5+
"packageManager": "yarn",
6+
"analytics": "e9693d44-eea8-4fdb-918a-9139355769eb"
67
},
78
"newProjectRoot": "projects",
89
"projects": {
@@ -28,7 +29,6 @@
2829
"skipTests": true
2930
},
3031
"@schematics/angular:module": {
31-
"skipTests": true
3232
},
3333
"@schematics/angular:pipe": {
3434
"skipTests": true
@@ -49,10 +49,20 @@
4949
"main": "src/main.ts",
5050
"polyfills": "src/polyfills.ts",
5151
"tsConfig": "tsconfig.app.json",
52-
"aot": true,
53-
"assets": ["src/favicon.ico", "src/assets"],
54-
"styles": ["src/styles.scss"],
55-
"scripts": []
52+
"assets": [
53+
"src/favicon.ico",
54+
"src/assets"
55+
],
56+
"styles": [
57+
"src/styles.scss"
58+
],
59+
"scripts": [],
60+
"vendorChunk": true,
61+
"extractLicenses": false,
62+
"buildOptimizer": false,
63+
"sourceMap": true,
64+
"optimization": false,
65+
"namedChunks": true
5666
},
5767
"configurations": {
5868
"production": {
@@ -65,7 +75,6 @@
6575
"optimization": true,
6676
"outputHashing": "all",
6777
"sourceMap": false,
68-
"extractCss": true,
6978
"namedChunks": false,
7079
"extractLicenses": true,
7180
"vendorChunk": false,
@@ -83,7 +92,8 @@
8392
}
8493
]
8594
}
86-
}
95+
},
96+
"defaultConfiguration": ""
8797
},
8898
"serve": {
8999
"builder": "@angular-devkit/build-angular:dev-server",
@@ -104,6 +114,5 @@
104114
}
105115
}
106116
}
107-
},
108-
"defaultProject": "client-app"
117+
}
109118
}

angular-universal-ssr/client-app/package.json

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,46 @@
22
"name": "angular-universal-ssr_client-app",
33
"version": "0.0.0",
44
"scripts": {
5+
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points",
56
"ng": "ng",
67
"start": "ng serve",
78
"build": "ng build",
89
"test": "ng test",
910
"lint": "ng lint",
1011
"e2e": "ng e2e",
11-
"serve:federation": "serve dist -l 5000 -s",
12+
"serve:federation": "serve dist -l 3000 -s",
1213
"build:federation": "webpack",
1314
"clean": "rm -rf dist"
1415
},
1516
"private": true,
1617
"dependencies": {
17-
"@angular/animations": "~10.2.0",
18-
"@angular/common": "~10.2.0",
19-
"@angular/compiler": "~10.2.0",
20-
"@angular/core": "~10.2.0",
21-
"@angular/forms": "~10.2.0",
22-
"@angular/platform-browser": "~10.2.0",
23-
"@angular/platform-browser-dynamic": "~10.2.0",
24-
"@angular/router": "~10.2.0",
25-
"rxjs": "~6.6.0",
26-
"serve": "^13.0.0",
27-
"tslib": "^2.0.0",
28-
"zone.js": "~0.11.0"
18+
"@angular/animations": "^15.1.2",
19+
"@angular/common": "^15.1.2",
20+
"@angular/compiler": "^15.1.2",
21+
"@angular/core": "^15.1.2",
22+
"@angular/forms": "^15.1.2",
23+
"@angular/platform-browser": "^15.1.2",
24+
"@angular/platform-browser-dynamic": "^15.1.2",
25+
"@angular/router": "^15.1.2",
26+
"rxjs": "^7.8.0",
27+
"serve": "^14.2.0",
28+
"tslib": "^2.5.0",
29+
"zone.js": "~0.12.0"
2930
},
3031
"devDependencies": {
31-
"@ngtools/webpack": "file:../patched_packages/_ngtools_webpack.tgz",
32-
"@angular-devkit/build-angular": "0.1102.19",
33-
"@angular/cli": "10.2.4",
34-
"@angular/compiler-cli": "10.2.5",
35-
"@types/node": "12.20.55",
32+
"@ngtools/webpack": "15.1.4",
33+
"@angular-devkit/build-angular": "15.1.4",
34+
"@angular/cli": "15.1.4",
35+
"@angular/compiler-cli": "15.1.2",
36+
"@types/node": "18.11.9",
3637
"clean-webpack-plugin": "4.0.0",
3738
"html-webpack-plugin": "5.5.0",
3839
"raw-loader": "4.0.2",
39-
"sass-loader": "12.6.0",
40-
"ts-node": "9.1.1",
41-
"tslint": "6.1.3",
42-
"typescript": "4.0.8",
43-
"webpack": "5.72.1",
44-
"webpack-cli": "4.10.0"
40+
"sass-loader": "13.2.0",
41+
"ts-node": "10.9.1",
42+
"tslint": "^6.1.3",
43+
"typescript": "4.9.5",
44+
"webpack": "5.75.0",
45+
"webpack-cli": "5.0.1"
4546
}
4647
}

angular-universal-ssr/client-app/src/app/app-routing.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const routes: Routes = [
1111
];
1212

1313
@NgModule({
14-
imports: [RouterModule.forRoot(routes)],
14+
imports: [RouterModule.forRoot(routes, {})],
1515
exports: [RouterModule],
1616
})
1717
export class AppRoutingModule {}

angular-universal-ssr/client-app/src/app/client-cities/client-cities-home/client-cities-home.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ export class ClientCitiesHomeComponent implements OnInit {
3636
);
3737
const componentInstance = this.viewContainer.createComponent(
3838
factory,
39-
null,
39+
0,
4040
this.injector,
41+
null,
4142
).instance;
4243
(componentInstance as any).city = city;
4344
});

angular-universal-ssr/client-app/src/app/client-cities/client-cities.module.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import { ClientCitiesRoutingModule } from './client-cities-routing.module';
55
import { ClientCityComponent } from './client-city/client-city.component';
66

77
@NgModule({
8-
declarations: [ClientCitiesHomeComponent, ClientCityComponent],
9-
imports: [CommonModule, ClientCitiesRoutingModule],
10-
exports: [ClientCitiesHomeComponent],
11-
entryComponents: [ClientCityComponent],
8+
declarations: [ClientCitiesHomeComponent, ClientCityComponent],
9+
imports: [CommonModule, ClientCitiesRoutingModule],
10+
exports: [ClientCitiesHomeComponent]
1211
})
1312
export class ClientCitiesModule {}

angular-universal-ssr/client-app/src/environments/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ export const environment = {
1313
* This import should be commented out in production mode because it will have a negative impact
1414
* on performance if an error is thrown.
1515
*/
16-
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
16+
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.

angular-universal-ssr/client-app/src/polyfills.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@
1818
* BROWSER POLYFILLS
1919
*/
2020

21-
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
22-
// import 'classlist.js'; // Run `npm install --save classlist.js`.
23-
24-
/**
25-
* Web Animations `@angular/platform-browser/animations`
26-
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
27-
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
28-
*/
29-
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
30-
3121
/**
3222
* By default, zone.js will patch all possible macroTask and DomEvents
3323
* user can disable parts of macroTask/DomEvents patch by setting following flags
@@ -55,7 +45,7 @@
5545
/***************************************************************************************************
5646
* Zone JS is required by default for Angular itself.
5747
*/
58-
import 'zone.js/dist/zone'; // Included with Angular CLI.
48+
import 'zone.js'; // Included with Angular CLI.
5949

6050
/***************************************************************************************************
6151
* APPLICATION IMPORTS

angular-universal-ssr/client-app/src/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
BrowserDynamicTestingModule,
66
platformBrowserDynamicTesting,
77
} from '@angular/platform-browser-dynamic/testing';
8-
import 'zone.js/dist/zone-testing';
8+
import 'zone.js/testing';
99

1010
declare const require: {
1111
context(

0 commit comments

Comments
 (0)