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

Upgrade to Angular 13 #1249

Merged
merged 17 commits into from
Apr 27, 2024
Merged

Upgrade to Angular 13 #1249

merged 17 commits into from
Apr 27, 2024

Conversation

cheehongw
Copy link
Contributor

@cheehongw cheehongw commented Feb 20, 2024

Summary:

Upgrade to Angular 13 and Node 16
This pull request addresses some of the outdated packages in our application.

Partially addresses #1192

Changes Made:

Proposed Commit Message:

Upgrade to Angular 13

Some of our packages are old and outdated. We should actively maintain 
and keep these packages up-to-date so it is easier to maintain in the 
future.

Let's upgrade to Angular 13 to keep our packages up-to-date.

@cheehongw
Copy link
Contributor Author

cheehongw commented Mar 4, 2024

Loading service still works

CATcher.3.5.2.-.CATcher-org_bugreporting.-.Google.Chrome.2024-03-04.12-02-31.mp4

@cheehongw cheehongw marked this pull request as ready for review March 4, 2024 05:06
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the most part! 🚀 code looks fine

Works alright on my machine as well

We have upgraded to Angular 13.

Lets bump ngx-markdown to v13 to support the newer Angular version.
This line gave me typescript erorr TS2362.
In Angular 13, FactoryComponent and FactoryComponentResolver API got
deprecated. This commit removes the deprecated API in favor of other
APIs where Component classes can be used directly.

The affected classes are loading.service.ts and its spec file.
The `[email protected]` library does not support Angular 13.

As such, we are upgrading to `[email protected]`. With this change,
there are several breaking changes that we must add to our codebase.

See: Migration guide to apollo-angular v3
https://the-guild.dev/graphql/apollo-angular/docs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀 Again, most of the changes are dependency based, and seems to work alright.

@luminousleek
Copy link
Contributor

System

OS: macOS Sonoma 14.4.1
Browser: Safari
Browser Version: Version 17.4.1 (19618.1.15.11.14)
Local Angular Version: 12.2.18
node Version: v14.19.3
npm Version: 6.14.17

Actions Run

npm install: success
npm run ng:serve:web: - had to run npx browserslist --updatedb for it to work
npm run test: - had to delete package-lock.json and node-modules and re-run npm install for it to work
npm run e2e: success

Tested Phases

  1. Bug Reporting Phase
  2. Team's Response Phase
  3. Tester's Response Phase

No bugs found

@luminousleek
Copy link
Contributor

Once we use Node 16 for the GitHub CI tests we need to update the branch protection to require linux-setup-and-tests (16.x) instead of linux-setup-and-tests (14.x)

@cheehongw
Copy link
Contributor Author

cheehongw commented Apr 27, 2024

Finally got the CI working. This comment will detail the changes made to the environment for the Angular 13 upgrade:

  • Upgrade to Node 16, npm8 from Node14, npm6

  • @octokit/core isn't used directly as a dependency in our project, but @octokit/rest depends on it and npm8 installs the latest one (v6.1.2), which doesnt support Node 16.

    • As such, this PR includes a new dev dependency dependency to freeze @octokit/core at v4, which is the last version to support Node 16
    • We should consider removing it once we upgrade to Angular 15, which supports Node 18.
  • Manually install firefox for the macos-latest runner. As of this comment, macos-latest uses a macos 14 arm64 image, which doesnt include firefox. This seems to be a very recent change, since macos-latest always pointed to a x64 image which came pre-installed with firefox.

@cheehongw
Copy link
Contributor Author

System

OS: Windows 10
Browser: Chrome
Browser Version: 124.0.6367.91
Local Angular Version: 13.4.0
node Version: 16.20.2
npm Version: 8.19.4

Actions Run

npm install
npm run ng:serve:web
npm run test
npm run e2e

All success

Tested Phases

  1. Bug Reporting Phase
  2. Team's Response Phase
  3. Tester's Response Phase

No bugs found

@chunweii
Copy link
Contributor

Finally got the CI working. This comment will detail the changes made to the environment for the Angular 13 upgrade:

  • Upgrade to Node 16, npm8 from Node14, npm6

  • @octokit/core isn't used directly as a dependency in our project, but @octokit/rest depends on it and npm8 installs the latest one (v6.1.2), which doesnt support Node 16.

    • As such, this PR includes a new dev dependency to freeze @octokit/core at v4, which is the last version to support Node 16
    • We should consider removing it once we upgrade to Angular 15, which supports Node 18.
  • Manually install firefox for the macos-latest runner. As of this comment, macos-latest uses a macos 14 arm64 image, which doesnt include firefox. This seems to be a very recent change, since macos-latest always pointed to a x64 image which came pre-installed with firefox.

Thanks for the fix @cheehongw! I have some comments on the octokit dependency.

  1. Dev dependencies should be reserved for dependencies that are only used during development and not needed in production. CATcher and WATcher has been so far installing everything for use in production so putting @octokit/core into devDependencies should not break stuff, but I think the best practice is to put it into the dependencies instead.
  2. Also, a better way to resolve the octokit issue would be to upgrade @octokit/rest to ^18.12.0, but this can cause some breaking changes (we need to change some parts of our code).

@cheehongw
Copy link
Contributor Author

Thanks for the review @chunweii

  1. Ok, will move octokit/core to dependencies
  2. Any reason for targeting octokit/[email protected]? I am unable to find anything in the octokit/rest release notes about changing how octokit/core is depended upon.
    • Either way and as you mentioned, the task of upgrading octokit/rest has alot of breaking changes. Going from v16 -> v17 alone seems to introduce quite a bit of breaking changes. As such, I think this is better off as a separate PR since it is not related to Angular 13.

@cheehongw
Copy link
Contributor Author

System

OS: Ubuntu 22.04
Browser: Chrome
Browser Version: 123.0.6312.122
Local Angular Version: 13.4.0
node Version: 16.20.2
npm Version: 8.19.4

Actions Run

npm install
npm run ng:serve:web
npm run test
npm run e2e

All success

Tested Phases

  1. Bug Reporting Phase
  2. Team's Response Phase
  3. Tester's Response Phase

No bugs found

@chunweii
Copy link
Contributor

  1. Any reason for targeting octokit/[email protected]? I am unable to find anything in the octokit/rest release notes about changing how octokit/core is depended upon.

    • Either way and as you mentioned, the task of upgrading octokit/rest has alot of breaking changes. Going from v16 -> v17 alone seems to introduce quite a bit of breaking changes. As such, I think this is better off as a separate PR since it is not related to Angular 13.

This old version of octokit (v16) does not support the use of ESM imports (I don't see it in the documentations), which imo makes the type checking better.

Furthermore, one of the dependencies in octokit/rest is causing the problem of installing an incompatible version of octokit/core. I tried installing v18 and there were no issues with installation afterwards (but I could also have tried 17, or some other version)

But I agree we should not upgrade octokit in this PR

@cheehongw cheehongw merged commit ed71498 into CATcher-org:master Apr 27, 2024
5 checks passed
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.

4 participants