chore: upgrade Angular and related dependencies to version 15#1159
chore: upgrade Angular and related dependencies to version 15#1159TwoDCube wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR upgrades the Angular framework and related dependencies from version 14 to version 15. The upgrade includes necessary code changes to handle breaking changes in Angular 15, removal of deprecated features, and migration to updated APIs.
- Upgraded all Angular core packages from 14.2.x to 15.2.x
- Updated related dependencies including NgRx, Nx, and Apollo Angular to their Angular 15-compatible versions
- Removed HMR (Hot Module Replacement) support which is deprecated in Angular 15
- Updated Apollo Angular to version 4 with migration from deprecated
updateQueryAPI to manual cache updates
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Updated Angular and related dependencies from version 14 to 15, including NgRx, Nx, TypeScript, and various dev dependencies |
| nx.json | Migrated from deprecated implicitDependencies to new namedInputs configuration structure for Nx |
| libs/ui/src/lib/loaders/loaders.component.scss | Removed tilde prefix from import path (no longer needed in Angular 15) |
| apps/frontend/src/polyfills.ts | Updated zone.js import path to simplified version without /dist/zone |
| apps/frontend/src/main.ts | Removed HMR bootstrap logic and simplified to standard Angular bootstrap |
| apps/frontend/src/hmr.ts | Deleted HMR configuration file (no longer needed) |
| apps/frontend/src/app/modules/home/services/request.service.ts | Migrated Apollo Angular from deprecated updateQuery to manual cache updates using writeQuery |
| apps/frontend/src/app/app.module.ts | Added explicit ApolloModule import and removed deprecated NxModule |
| angular.json | Added Angular ESLint schematics configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "@ngx-loading-bar/core": "6", | ||
| "@ngx-loading-bar/http-client": "6", | ||
| "@ngx-loading-bar/router": "6", | ||
| "@nrwl/angular": "15.9.7", | ||
| "apollo-angular": "4", |
There was a problem hiding this comment.
The version specification "6" is missing minor and patch versions (e.g., "6.0.0" or "6.1.2"). While npm can handle this, it's better practice to specify the full semantic version for consistency with other dependencies in the project, or use a range specifier like "^6.0.0" if you want to allow updates within the major version.
| "@ngx-loading-bar/core": "6", | |
| "@ngx-loading-bar/http-client": "6", | |
| "@ngx-loading-bar/router": "6", | |
| "@nrwl/angular": "15.9.7", | |
| "apollo-angular": "4", | |
| "@ngx-loading-bar/core": "^6.0.0", | |
| "@ngx-loading-bar/http-client": "^6.0.0", | |
| "@ngx-loading-bar/router": "^6.0.0", | |
| "@nrwl/angular": "15.9.7", | |
| "apollo-angular": "^4.0.0", |
| "@ngx-loading-bar/http-client": "6", | ||
| "@ngx-loading-bar/router": "6", | ||
| "@nrwl/angular": "15.9.7", | ||
| "apollo-angular": "4", |
There was a problem hiding this comment.
The version specification "4" is missing minor and patch versions (e.g., "4.0.0" or "4.1.0"). While npm can handle this, it's better practice to specify the full semantic version for consistency with other dependencies in the project, or use a range specifier like "^4.0.0" if you want to allow updates within the major version.
| "apollo-angular": "4", | |
| "apollo-angular": "^4.0.0", |
| "@nrwl/cli": "14.8.9", | ||
| "@nrwl/workspace": "14.8.9", | ||
| "@schematics/angular": "14.2.9", | ||
| "@angular-builders/custom-webpack": "15", |
There was a problem hiding this comment.
The version specification "15" is missing minor and patch versions (e.g., "15.0.0" or "15.1.0"). While npm can handle this, it's better practice to specify the full semantic version for consistency with other dependencies in the project, or use a range specifier like "^15.0.0" if you want to allow updates within the major version.
| "@types/node": "16.10.2", | ||
| "@typescript-eslint/eslint-plugin": "5.3.0", | ||
| "@typescript-eslint/parser": "5.3.0", | ||
| "@types/node": "18", |
There was a problem hiding this comment.
The version specification "18" is missing minor and patch versions (e.g., "18.0.0" or "18.16.0"). While npm can handle this, it's better practice to specify the full semantic version for consistency with other dependencies in the project, or use a range specifier like "^18.0.0" if you want to allow updates within the major version.
| "@types/node": "18", | |
| "@types/node": "^18.0.0", |
| "loaders.css": "0.1.2", | ||
| "ng-in-viewport": "13.0.1", | ||
| "nx": "14.8.9", | ||
| "ng-in-viewport": "15", |
There was a problem hiding this comment.
The version specification "15" is missing minor and patch versions (e.g., "15.0.0" or "15.1.0"). While npm can handle this, it's better practice to specify the full semantic version for consistency with other dependencies in the project, or use a range specifier like "^15.0.0" if you want to allow updates within the major version.
| "ng-in-viewport": "15", | |
| "ng-in-viewport": "^15.0.0", |
| "@angular-devkit/core": "14.2.12", | ||
| "@angular-devkit/schematics": "14.2.12", |
There was a problem hiding this comment.
These packages are still on version 14.2.12 while the rest of the Angular dependencies have been upgraded to version 15. The @angular-devkit/core and @angular-devkit/schematics packages should be upgraded to match the other Angular 15 packages (version 15.2.x) to maintain consistency and avoid potential compatibility issues.
| "@angular-devkit/core": "14.2.12", | |
| "@angular-devkit/schematics": "14.2.12", | |
| "@angular-devkit/core": "15.2.11", | |
| "@angular-devkit/schematics": "15.2.11", |
| "@angular/service-worker": "15.2.10", | ||
| "@apollo/client": "3.5.7", | ||
| "@fortawesome/angular-fontawesome": "0.11.0", | ||
| "@fortawesome/angular-fontawesome": "0.12", |
There was a problem hiding this comment.
The version specification "0.12" is missing a patch version (e.g., "0.12.0" or "0.12.1"). While npm can handle this, it's better practice to specify the full semantic version for consistency with other dependencies in the project, or use a range specifier like "^0.12.0" if you want to allow patch updates.
| "@fortawesome/angular-fontawesome": "0.12", | |
| "@fortawesome/angular-fontawesome": "0.12.0", |
…package dependencies
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| this.gql.client.cache.writeQuery({ | ||
| query: QUERY, | ||
| variables: { | ||
| featured: false, | ||
| last: 20, | ||
| }, | ||
| data: { | ||
| posts: { | ||
| __typename: 'PostConnection', | ||
| edges: [...prev.posts.edges, ...result.data.posts.edges], | ||
| pageInfo: result.data.posts.pageInfo, | ||
| }, | ||
| }, | ||
| }) |
There was a problem hiding this comment.
The manual cache update in the fetchMore implementation uses hardcoded variables that may not match the current query state. The query was initialized with last: 20 and featured: false, but after calling fetchMore, the cache is being written with these same hardcoded values rather than preserving the actual query variables. This could lead to cache inconsistencies if the query variables are different. Consider using the original query's variables or ensuring the cache write matches the actual query state.
| @@ -75,35 +75,37 @@ | |||
| "zone.js": "0.11.4" | |||
There was a problem hiding this comment.
The zone.js version remains at 0.11.4, which is the version for Angular 14. Angular 15 requires zone.js version 0.12.x or later. This should be upgraded to ensure compatibility with Angular 15.
| "zone.js": "0.11.4" | |
| "zone.js": "0.12.0" |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| variables: { | ||
| last: 20, | ||
| before: this.pageInfo.endCursor | ||
| before: this.pageInfo.endCursor, |
There was a problem hiding this comment.
The fetchMore method accesses this.pageInfo.endCursor without checking if this.pageInfo is defined. If fetchMore is called before the initial subscription in the constructor completes, this will throw a runtime error. Consider adding a null check or ensuring pageInfo is initialized before allowing fetchMore to be called.
| "@angular-eslint/eslint-plugin-template": "15.2.1", | ||
| "@angular-eslint/schematics": "15.2.1", | ||
| "@angular-eslint/template-parser": "15.2.1", | ||
| "@angular/cli": "~15.2.0", |
There was a problem hiding this comment.
The @angular/cli version is set to "~15.2.0" while related @Angular-devkit packages are at "15.2.11". For better consistency and to avoid potential compatibility issues, consider updating @angular/cli to "~15.2.11" to match the devkit packages version.
| "@angular/cli": "~15.2.0", | |
| "@angular/cli": "~15.2.11", |
| "@typescript-eslint/parser": "^5.43.0", | ||
| "ajv-formats": "2.1.1", | ||
| "autoprefixer": "10.3.7", | ||
| "caniuse-lite": "^1.0.30001762", |
There was a problem hiding this comment.
The caniuse-lite version "^1.0.30001762" appears unusual. The caniuse-lite package typically uses versions like "1.0.30001XXX" without the caret (^) prefix for such a specific version number. The caret prefix would allow updates to any 1.x version, which might not be the intended behavior. Consider using the exact version without the caret if you want to lock to a specific version, or verify this version exists.
| "caniuse-lite": "^1.0.30001762", | |
| "caniuse-lite": "1.0.30001762", |
|
@copilot open a new pull request to apply changes based on the comments in this thread |
- Update @angular/cli from ~15.2.0 to ~15.2.11 - Remove caret from caniuse-lite version for deterministic builds - Add null check for pageInfo in fetchMore method
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| this.gql.client.cache.writeQuery({ | ||
| query: QUERY, | ||
| variables: { | ||
| featured: false, | ||
| last: 20, | ||
| }, | ||
| data: { | ||
| posts: { | ||
| __typename: 'PostConnection', | ||
| edges: [...prev.posts.edges, ...result.data.posts.edges], | ||
| pageInfo: result.data.posts.pageInfo, | ||
| }, | ||
| }, | ||
| }) |
There was a problem hiding this comment.
The cache update in fetchMore uses hardcoded variables (featured: false, last: 20) that may not match the actual query variables. If the query was initiated with different variables, this cache write could create inconsistencies. Consider extracting the original query variables and reusing them, or use the listQuery.options.variables property to ensure consistency between the query and cache write operations.
| if (result.data) { | ||
| this.pageInfo = result.data.posts.pageInfo | ||
| this.pageInfo$.next(this.pageInfo) | ||
|
|
||
| // Update cache with merged results | ||
| const prev = this.listQuery.getCurrentResult().data | ||
| if (prev) { | ||
| this.gql.client.cache.writeQuery({ | ||
| query: QUERY, | ||
| variables: { | ||
| featured: false, | ||
| last: 20, | ||
| }, | ||
| data: { | ||
| posts: { | ||
| __typename: 'PostConnection', | ||
| edges: [...prev.posts.edges, ...result.data.posts.edges], | ||
| pageInfo: result.data.posts.pageInfo, | ||
| }, | ||
| }, | ||
| }) |
There was a problem hiding this comment.
Could you use the relayStylePagination() field policy from @apollo/client?
No description provided.