Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(spa): upgrade Angular to version 9.* #18956

Closed
wants to merge 1 commit into from

Conversation

peterblazejewicz
Copy link
Contributor

  • project structure alignment with Angular CLI generated content,
    including location of the files and naming conventions
  • content update for configuration files
  • dependency listing changed
  • minor change in template to comply with hardened template type checks
  • minor change in authorization service to overcome problem with changed
    shape of types provided by 3rd party library used in templates (added
    fixme note).

Addresses #14076

- project structure alignment with Angular CLI generated content,
including location of the files and naming conventions
- content update for configuration files
- dependency listing changed
- minor change in template to comply with hardened template type checks
- minor change in authorization service to overcome problem with changed
shape of types provided by 3rd party library used in templates (added
fixme note).

Addresses: dotnet#14076
@ghost ghost added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Feb 11, 2020
@peterblazejewicz
Copy link
Contributor Author

details of errors fixes:
#1 linting errors

ClientApp/src/api-authorization/authorize.guard.ts:15:5 - variable name must be in lowerCamelCase, PascalCase or UPPER_CASE

#2 linting error:

/src/api-authorization/login-menu/login-menu.component.html:9:30 - Async pipes should not be negated. Use (observable | async) === (false | null | undefined) to check its value instead

#3 compile time errors (oidc-client):

ERROR in src/api-authorization/authorize.service.ts:77:29 - error TS2345: Argument of type 'Profile' is not assignable to parameter of type 'IUser'.  Property 'name' is optional in type 'Profile' but required in type 'IUser'.

77       this.userSubject.next(user.profile);
                               ~~~~~~~~~~~~
src/api-authorization/authorize.service.ts:88:31 - error TS2345: Argument of type 'Profile' is not assignable to parameter of type 'IUser'.

88         this.userSubject.next(user.profile);
                                 ~~~~~~~~~~~~
src/api-authorization/authorize.service.ts:114:29 - error TS2345: Argument of type 'Profile' is not assignable to parameter of type 'IUser'.        
114       this.userSubject.next(user && user.profile);
                                ~~~~~~~~~~~~~~~~~~~~
src/api-authorization/authorize.service.ts:149:42 - error TS2339: Property 'data' does not exist on type 'SignoutResponse'.

149       return this.success(state && state.data);
                                             ~~~~
src/api-authorization/authorize.service.ts:194:5 - error TS2322: Type 'Observable<Profile>' is not assignable to type 'Observable<IUser>'.
  Type 'Profile' is not assignable to type 'IUser'.

194     return from(this.ensureUserManagerInitialized())
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195       .pipe(
    ~~~~~~~~~~~~
196         mergeMap(() => this.userManager.getUser()),
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
197         map(u => u && u.profile));
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#1 and #2 resulted in minor change in source code
#3 has been circumvented by wrapping with custom ad-hoc type to correct types shape for compilation without changing the 3rd party module details (yet)

@peterblazejewicz
Copy link
Contributor Author

Also note that blocker: #17277
I can observe the same problem with this updated content tested on 3.1 or 5.*.
The built-in ProjectTempaltes E2E tests passes though on my local machine with content of this PR

@varghesep
Copy link

I have been waiting for a few months for a aspnetcore release with which I can create Angular 9 client apps in Visual Studio 2019. Are there any instructions to consume the template in Visual Studio 2019 and create one right away before the official release?

@peterblazejewicz
Copy link
Contributor Author

Are there any instructions to consume the template in Visual Studio 2019 and create one right away before the official release?

So the Angular CLI comes with ng update, so I would switch to ClientApp directory (make a backup first) and run official update migration. See my comments above about possible errors to be fixed in your code (e.g. template errors under Ivy).
More: https://update.angular.io/

@mkArtakMSFT mkArtakMSFT removed this from the 5.0.0-preview4 milestone Apr 17, 2020
@mkArtakMSFT mkArtakMSFT requested a review from javiercn April 17, 2020 20:14
@mkArtakMSFT mkArtakMSFT added the community-contribution Indicates that the PR has been added by a community member label Jul 20, 2020
@javiercn
Copy link
Member

@peterblazejewicz thanks for submitting a PR for this.

Unfortunately, at the time we are looking for other ways to keep the version in this template up to date, so we are closing this PR for the time being, since it might conflict with other changes.

Thanks again and we're sorry for the trouble.

@javiercn javiercn closed this Oct 23, 2020
@peterblazejewicz
Copy link
Contributor Author

@javiercn no worries, thx for the update!

@peterblazejewicz peterblazejewicz deleted the feat/14076 branch October 23, 2020 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants