Skip to content

chore: upgrade to angular 12 #1073

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 26 commits into from
Aug 20, 2021
Merged

chore: upgrade to angular 12 #1073

merged 26 commits into from
Aug 20, 2021

Conversation

itssharmasandeep
Copy link
Contributor

No description provided.

@itssharmasandeep itssharmasandeep requested a review from a team as a code owner August 18, 2021 15:59
@codecov
Copy link

codecov bot commented Aug 18, 2021

Codecov Report

Merging #1073 (5fceefe) into main (36aaeea) will increase coverage by 0.00%.
The diff coverage is 88.23%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1073   +/-   ##
=======================================
  Coverage   85.08%   85.08%           
=======================================
  Files         822      822           
  Lines       16924    16928    +4     
  Branches     2045     2044    -1     
=======================================
+ Hits        14399    14404    +5     
+ Misses       2494     2493    -1     
  Partials       31       31           
Impacted Files Coverage Δ
src/polyfills.ts 0.00% <0.00%> (ø)
...ects/common/src/utilities/coercers/date-coercer.ts 100.00% <100.00%> (ø)
...on/src/utilities/formatters/date/date-formatter.ts 84.84% <100.00%> (+4.84%) ⬆️
...src/utilities/formatters/date/display-date.pipe.ts 100.00% <100.00%> (ø)
.../cells/data-parsers/table-cell-timestamp-parser.ts 86.66% <100.00%> (+2.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 36aaeea...5fceefe. Read the comment docs.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@anandtiwary
Copy link
Contributor

@itssharmasandeep before merging, please verify ht-ui end to end with real data. Look for any weirdness or any console error.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@anandtiwary
Copy link
Contributor

not seeing any errors on npm 6 locally.

@aaron-steinfeld
Copy link
Contributor

not seeing any errors on npm 6 locally.

what version? I was able to locally repro those build errors with

npx npm@6.14.14 ci && npm run lint

@anandtiwary
Copy link
Contributor

npm: 6.14.11

node: v15.3.0

@anandtiwary
Copy link
Contributor

not seeing any errors on npm 6 locally.

what version? I was able to locally repro those build errors with

npx npm@6.14.14 ci && npm run lint

even with this, i am not seeing any error at install time. What node version are you in?

The only error i see is during lint

Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
TSLint's support is discontinued and we're deprecating its support in Angular CLI.
To opt-in using the community driven ESLint builder, see: https://github.com/angular-eslint/angular-eslint#migrating-an-angular-cli-project-from-codelyzer-and-tslint.
Linting "hypertrace-ui"...
The 'deprecation' rule threw an error in '/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/projects/common/src/utilities/rxjs/rxjs-utils.ts':
TypeError: message.trim is not a function
    at Function.Rule.FAILURE_STRING (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/tslint/lib/rules/deprecationRule.js:31:81)
    at cb (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/tslint/lib/rules/deprecationRule.js:58:53)
    at visitNode (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:28995:24)
    at Object.forEachChild (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:29134:24)
    at cb (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/tslint/lib/rules/deprecationRule.js:70:23)
    at visitNodes (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:29004:30)
    at Object.forEachChild (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:29128:21)
    at cb (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/tslint/lib/rules/deprecationRule.js:70:23)
    at visitNode (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:28995:24)
    at Object.forEachChild (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:29060:21)
The 'deprecation' rule threw an error in '/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/projects/common/src/navigation/navigation.service.ts':
TypeError: message.trim is not a function

@aaron-steinfeld
Copy link
Contributor

aaron-steinfeld commented Aug 19, 2021

not seeing any errors on npm 6 locally.

what version? I was able to locally repro those build errors with

npx npm@6.14.14 ci && npm run lint

even with this, i am not seeing any error at install time. What node version are you in?

The only error i see is during lint

Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
TSLint's support is discontinued and we're deprecating its support in Angular CLI.
To opt-in using the community driven ESLint builder, see: https://github.com/angular-eslint/angular-eslint#migrating-an-angular-cli-project-from-codelyzer-and-tslint.
Linting "hypertrace-ui"...
The 'deprecation' rule threw an error in '/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/projects/common/src/utilities/rxjs/rxjs-utils.ts':
TypeError: message.trim is not a function
    at Function.Rule.FAILURE_STRING (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/tslint/lib/rules/deprecationRule.js:31:81)
    at cb (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/tslint/lib/rules/deprecationRule.js:58:53)
    at visitNode (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:28995:24)
    at Object.forEachChild (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:29134:24)
    at cb (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/tslint/lib/rules/deprecationRule.js:70:23)
    at visitNodes (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:29004:30)
    at Object.forEachChild (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:29128:21)
    at cb (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/tslint/lib/rules/deprecationRule.js:70:23)
    at visitNode (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:28995:24)
    at Object.forEachChild (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:29060:21)
The 'deprecation' rule threw an error in '/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/projects/common/src/navigation/navigation.service.ts':
TypeError: message.trim is not a function

I guess it could be the node resolution, but that'd surprise me. I'm able to consistently repro this when running against this branch - and I use node 16.6.1.

The error is never at install, it's always at lint - it's basically an artifact, I believe, of how the two versions of npm respect peer dependencies.

I was curious so I tried against the main branch, which works fine - the reason, I'm guessing, being that the problematic package that only works in newer npm (ajv-format) wasn't part of the dependency tree until the ng upgrade.

@aaron-steinfeld
Copy link
Contributor

aaron-steinfeld commented Aug 19, 2021

Also, it's continuing to fail because we're not actually doing an install here (at least, that's the first issue) - my oversight, we should update the cache key's prefix (across all jobs), so we don't pull the old result (with the same lock) from cache and instead regenerate.

@github-actions

This comment has been minimized.

@itssharmasandeep
Copy link
Contributor Author

I updated the cached key a bit and checks worked fine, I just changed node to node-modules in the key

@itssharmasandeep
Copy link
Contributor Author

itssharmasandeep commented Aug 20, 2021

Also, it's continuing to fail because we're not actually doing an install here (at least, that's the first issue) - my oversight, we should update the cache key's prefix (across all jobs), so we don't pull the old result (with the same lock) from cache and instead regenerate.

I think making every cache key different in different jobs would not make that big of a difference, I think changing it to start of the workflow inside npm-install-if-needed would be enough so that it did a new npm ci, although I am not sure why did not do that since we changed the package-lock

@itssharmasandeep
Copy link
Contributor Author

not seeing any errors on npm 6 locally.

what version? I was able to locally repro those build errors with

npx npm@6.14.14 ci && npm run lint

even with this, i am not seeing any error at install time. What node version are you in?

The only error i see is during lint

Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
TSLint's support is discontinued and we're deprecating its support in Angular CLI.
To opt-in using the community driven ESLint builder, see: https://github.com/angular-eslint/angular-eslint#migrating-an-angular-cli-project-from-codelyzer-and-tslint.
Linting "hypertrace-ui"...
The 'deprecation' rule threw an error in '/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/projects/common/src/utilities/rxjs/rxjs-utils.ts':
TypeError: message.trim is not a function
    at Function.Rule.FAILURE_STRING (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/tslint/lib/rules/deprecationRule.js:31:81)
    at cb (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/tslint/lib/rules/deprecationRule.js:58:53)
    at visitNode (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:28995:24)
    at Object.forEachChild (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:29134:24)
    at cb (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/tslint/lib/rules/deprecationRule.js:70:23)
    at visitNodes (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:29004:30)
    at Object.forEachChild (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:29128:21)
    at cb (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/tslint/lib/rules/deprecationRule.js:70:23)
    at visitNode (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:28995:24)
    at Object.forEachChild (/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/node_modules/typescript/lib/typescript.js:29060:21)
The 'deprecation' rule threw an error in '/Users/anand.tiwary/trc/traceable-ui/hypertrace-ui/projects/common/src/navigation/navigation.service.ts':
TypeError: message.trim is not a function

This error might be related to deprecation of TSLint but not sure

@aaron-steinfeld
Copy link
Contributor

I think making every cache key different in different jobs would not make that big of a difference, I think changing it to start of the workflow inside npm-install-if-needed would be enough so that it did a new npm ci, although I am not sure why did not do that since we changed the package-lock

The lock changed, and it did do a new install - see the last commit where it actually changed ( https://github.com/hypertrace/hypertrace-ui/runs/3372942782 )
After that, we updated the npm version which is not accounted for in the cache key, so it never reran. The cache keys need to match across all jobs - couldn't just update npm-install-if-needed, else the other jobs would be reading a different version of node_modules than the workflow has set up.

This error might be related to deprecation of TSLint but not sure

More or less - the issue is that the format the parser returns for a deprecation has changed I believe, but the tslint rules are no longer being maintained so the newer typescript is breaking them. I'd say let's either ignore it since we're about to migrate from tslint or remove the deprecation rule (or both!).

@@ -21,7 +21,7 @@ jobs:
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

this needs to be updated in the publish job, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I saw that and I think we're doing something different in publish job

  1. restoreKeys contain package.json instead of package-lock.json in the key value and I think it would always be different right?
  2. we're not checking cache-hit and every time we're doing npm ci so cache part seems unused here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

name: Publish artifacts
on:
  # Will only run when release is published.
  release:
    types:
      - created
  workflow_dispatch:

jobs:
  publish-docker:
    runs-on: ubuntu-20.04
    steps:
      # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
      - name: Check out code
        uses: actions/checkout@v2.3.4
        with:
          fetch-depth: 0

      - name: Cache node modules
        uses: actions/cache@v2
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-${{ hashFiles('package.json') }}-
            ${{ runner.os }}-node-

      - name: NPM Install
        run: npm ci

      - name: Build
        run: npm run build:ci

Copy link
Contributor

Choose a reason for hiding this comment

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

whoops - yeah, that one is different but shouldn't be. It will still work, just off fresh node modules each time - so we can come back to that as tech debt.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should we go ahead and merge this PR?

@itssharmasandeep
Copy link
Contributor Author

I have tested this with npm ci , doesn't give any error and build and tested the ht-ui with some data, I think it is working fine, no console errors.

@itssharmasandeep itssharmasandeep changed the title Chore: Upgrade to angular 12 chore: upgrade to angular 12 Aug 20, 2021
@@ -64,7 +64,6 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Yep. This would fix that warning

@github-actions

This comment has been minimized.

@@ -1,3 +1,4 @@
@use '~@angular/material' as mat;
Copy link
Contributor

Choose a reason for hiding this comment

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

We need this change in all scss. @import -> @use

Copy link
Contributor

Choose a reason for hiding this comment

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

But this can happen separately.

@@ -329,3 +330,7 @@ $font-family: 'Work Sans', sans-serif;
@mixin axis-title($color: $gray-9) {
@include chart-small-regular;
}

$mat-typography: mat.define-typography-config(
Copy link
Contributor

Choose a reason for hiding this comment

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

Did this come on its own with migration

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggested this from reading the docs - looks like they have some form of migration for it, but not sure exactly what conditions trigger it or if we just skipped it: angular/components#22698

@itssharmasandeep itssharmasandeep merged commit 87ece1d into main Aug 20, 2021
@itssharmasandeep itssharmasandeep deleted the ng-12 branch August 20, 2021 16:15
@github-actions
Copy link

Unit Test Results

    4 files  ±0  265 suites  ±0   16m 12s ⏱️ - 1m 9s
951 tests ±0  951 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
958 runs  ±0  958 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 87ece1d. ± Comparison against base commit 322ee99.

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.

3 participants