Skip to content

Upgrade to Angular 12 #136

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

Merged
merged 7 commits into from
Jul 21, 2022
Merged

Upgrade to Angular 12 #136

merged 7 commits into from
Jul 21, 2022

Conversation

meisekimiu
Copy link
Contributor

@meisekimiu meisekimiu commented Jul 18, 2022

This PR upgrades our Angular version from Angular 11 to Angular 12. This includes upgrading Angular's core libraries to version 12, as well as upgrading peer dependencies to versions that are compatible to Angular 12 (such as upgrading shallow-render to a newer version that supports Angular 12). Angular-CLI automates some of the migration process, and these automated changes are included in their own commit. In addition, some manual changes needed to be made to get everything working.

To test:

  • Make sure to run npm install
  • Run tests, the local dev proxy, and a production build
  • Make sure the app is working

At the current time, one issue is that we do get a bunch of deprecation warnings from Sass when running any builds/tests/dev servers. However, these are currently not breaking changes, only deprecation warnings. Do we want to tackle that in this PR or just add it as an issue to be resolved separately from the main upgrade?
Note: A lot of these deprecation warnings are related to #127 and would be resolved by fixing it.

Resolves PER-8853: Upgrade to Angular 12. This PR also resolves #131, but not the other dependabot PRs at this time. Also resolves #137.

This updates the core Angular libraries to Angular version 12. There are
also upgrades to various peer dependencies which need to be upgraded to
versions compatible with Angular 12, such as ng-bootstrap and
shallow-render.

This upgrade was performed with the following (long!) command:

```
npx ng update @angular-eslint/builder@12 \
@angular-eslint/eslint-plugin@12 \
@angular-eslint/eslint-plugin-template@12 \
@angular-eslint/schematics@12 \
@angular-eslint/template-parser@12 \
@angular/core@12 @angular/cli@12 @angular/cdk@12 \
@angular/google-maps@12 @angular/compiler-cli@12 \
@angular/language-service@12 @angular/localize@12 \
@angular/animations@12 @angular/common@12 \
@angular/forms@12 @angular/platform-browser@12 \
@angular/router@12 @ng-bootstrap/ng-bootstrap@10 \
shallow-render@12 @angular-devkit/build-angular@12
```

PER-8853: Upgrade to Angular 12
These changes were automatically added by the Angular-CLI as part of the
upgrade process.

PER-8853: Upgrade to Angular 12
With Angular and its dependencies upgraded, the Promise on line 97 of
`publish.component.ts` creates a compilation error. This can be fixed by
specifying the type of the Promise with `Promise<void>` instead of
`Promise`.

Because of autoformatting, the other changes in this file are just
changes from Prettier.

PER-8853: Upgrade to Angular 12
With Angular and dependencies upgraded, the `NgbDatepickerConfig` class
has changed its `showWeekdays` property to just `weekdays`. This caused
a compilation error. Let's fix it.

PER-8853: Upgrade to Angular 12
Because of Angular and other dependency upgrades, importing `isArray`
from `'util'` causes a compilation error and no longer works. Instead,
let's just use the native JavaScript version: `Array.isArray`. This
replaces the occurrences of `util.isArray` in the `connector.repo.ts`
file.

PER-8853: Upgrade to Angular 12
Angular 12 requires `emitDecoratorMetadata` to be set to false in
tsconfig, and for some reason it doesn't automatically do this with its
migration tool. In addition, remove "commonjs" from `tsconfig.spec.json`
to allow tests to work with the upgrade.

PER-8853: Upgrade to Angular 12
Previously we were attaching release information to the environment
confiuration by importing `version` from Package.json. Because of
Angular and other dependency upgrades, importing named exports like this
from a JSON file is no longer allowed. Let's instead just import the
whole file as an object and refer to its `version` property.

PER-8853: Upgrade to Angular 12
@meisekimiu meisekimiu marked this pull request as ready for review July 18, 2022 21:19
@meisekimiu meisekimiu merged commit 2eabcee into main Jul 21, 2022
@meisekimiu meisekimiu deleted the angular-12 branch July 21, 2022 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants