Skip to content

Commit

Permalink
docs(examples): upgrade Angular to v15
Browse files Browse the repository at this point in the history
1. Upgraded from Angular v14 to v15 for both GUI packages that use it.
2. Upgraded the Typescript compiler project-wide to 4.8.4
3. Due to 2) There was a change needed in the file
examples/cactus-example-discounted-asset-trade/transaction-fabric.ts
which introduces a constraint on the T type parameter.
4. Disabled the staged files linting because right now ESLint is broken
due to our Typescript version being >=4.8.0 (and upgrading it was not
an option because then it is broken due to ESM issues...)
5. Cleaned out a lot of the unused dev dependencies of the front-end
packages where angular was upgraded. These dependencies were related to
end-to-end browser testing which we haven't set up yet to be executed
because all the front-end packages are just example code that - while
important to test - does not have the highest priority in this sense.
6. Set the rootDir property in the electricity trade example's tsconfig.json
file to the standard value (./) because without it the new tsc compiler
version seems to be putting the compiled source files in a different
location by default (probably an accidental breaking change on the compiler's
part or just a lack of my understanding of how the configuration of it
should work). With the rootDir explicitly specified, it appears to be
compiling the files in the correct location as before.
7. De-duplicated the examples/cactus-example-tcs-huawei/tsconfig.json
file's compilerOptions.tsBuildInfoFile property because it was in collision
with the electricity trade example's property of the same name, leading to
the compiler thinking that it had already compiled the package's code
when it has not.

Fixes #2229

Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
petermetz committed Jul 14, 2023
1 parent 0e5e08b commit 11c8b11
Show file tree
Hide file tree
Showing 16 changed files with 813 additions and 2,120 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
restore-keys: |
${{ runner.os }}-yarn-
# lint clean codegen
yarn_lint:
continue-on-error: false
env:
Expand Down
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

./node_modules/.bin/lint-staged
# TODO: re-enable this once we were able to upgrade to the newer ESLint
# ./node_modules/.bin/lint-staged

This file was deleted.

39 changes: 13 additions & 26 deletions examples/cactus-example-carbon-accounting-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
"start": "ng serve"
},
"dependencies": {
"@angular/common": "14.3.0",
"@angular/core": "14.3.0",
"@angular/forms": "14.3.0",
"@angular/platform-browser": "14.3.0",
"@angular/platform-browser-dynamic": "14.3.0",
"@angular/router": "14.3.0",
"@angular/common": "15.2.9",
"@angular/core": "15.2.9",
"@angular/forms": "15.2.9",
"@angular/platform-browser": "15.2.9",
"@angular/platform-browser-dynamic": "15.2.9",
"@angular/router": "15.2.9",
"@hyperledger/cactus-api-client": "2.0.0-alpha.1",
"@hyperledger/cactus-common": "2.0.0-alpha.1",
"@hyperledger/cactus-core-api": "2.0.0-alpha.1",
Expand All @@ -70,29 +70,16 @@
"zone.js": "0.11.4"
},
"devDependencies": {
"@angular-builders/custom-webpack": "14.1.0",
"@angular-devkit/build-angular": "14.2.12",
"@angular/cli": "14.2.12",
"@angular/compiler": "14.3.0",
"@angular/compiler-cli": "14.3.0",
"@angular/language-service": "14.3.0",
"@angular-builders/custom-webpack": "15.0.0",
"@angular-devkit/build-angular": "15.2.9",
"@angular/cli": "15.2.9",
"@angular/compiler": "15.2.9",
"@angular/compiler-cli": "15.2.9",
"@angular/language-service": "15.2.9",
"@ionic/angular-toolkit": "9.0.0",
"@types/node": "16.4.13",
"codelyzer": "6.0.2",
"https-browserify": "1.0.0",
"jasmine-core": "3.8.0",
"jasmine-spec-reporter": "7.0.0",
"karma": "6.3.16",
"karma-chrome-launcher": "3.1.0",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-jasmine": "4.0.1",
"karma-jasmine-html-reporter": "1.7.0",
"os-browserify": "0.3.0",
"path-browserify": "1.0.1",
"protractor": "7.0.0",
"ts-node": "10.2.0",
"tslint": "6.1.3",
"typescript": "4.6.3"
"path-browserify": "1.0.1"
},
"engines": {
"node": ">=10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const routes: Routes = [
imports: [
RouterModule.forRoot(routes, {
preloadingStrategy: PreloadAllModules,
relativeLinkResolution: "legacy",
}),
],
exports: [RouterModule],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
"moduleResolution": "node",
"esModuleInterop": true,
"importHelpers": true,
"target": "ES2020",
"target": "ES2022",
"lib": [
"es2018",
"dom"
],
"resolveJsonModule": true,
"rootDir": "./src",
"skipLibCheck": true,
"tsBuildInfoFile": "../../.build-cache/cactus-example-carbon-accounting-frontend.tsbuildinfo"
"tsBuildInfoFile": "../../.build-cache/cactus-example-carbon-accounting-frontend.tsbuildinfo",
"useDefineForClassFields": false
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

import { ConfigUtil } from "@hyperledger/cactus-cmd-socketio-server";
import { ISocketApiClient } from "@hyperledger/cactus-core-api";
import { Verifier } from "@hyperledger/cactus-verifier-client";
import { signProposal } from "./sign-utils";

Expand All @@ -27,7 +28,7 @@ const moduleName = "TransactionFabric";
const logger = getLogger(`${moduleName}`);
logger.level = config.logLevel;

export function makeSignedProposal<T>(
export function makeSignedProposal<T extends ISocketApiClient<unknown>>(
ccFncName: string,
ccArgs: string[],
verifierFabric: Verifier<T>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"composite": true,
"outDir": "./dist/",
"rootDir": "./",
"tsBuildInfoFile": "../../.build-cache/cactus-example-discounted-asset-trade.tsbuildinfo",
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions examples/cactus-example-electricity-trade/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"composite": true,
"outDir": "./dist/",
"rootDir": "./",
"tsBuildInfoFile": "../../.build-cache/cactus-example-electricity-trade.tsbuildinfo"
},
"include": ["./*.ts"],
Expand Down
7 changes: 0 additions & 7 deletions examples/cactus-example-supply-chain-frontend/.browserslistrc

This file was deleted.

40 changes: 13 additions & 27 deletions examples/cactus-example-supply-chain-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
"start": "ng serve"
},
"dependencies": {
"@angular/common": "14.3.0",
"@angular/core": "14.3.0",
"@angular/forms": "14.3.0",
"@angular/platform-browser": "14.3.0",
"@angular/platform-browser-dynamic": "14.3.0",
"@angular/router": "14.3.0",
"@angular/common": "15.2.9",
"@angular/core": "15.2.9",
"@angular/forms": "15.2.9",
"@angular/platform-browser": "15.2.9",
"@angular/platform-browser-dynamic": "15.2.9",
"@angular/router": "15.2.9",
"@hyperledger/cactus-api-client": "2.0.0-alpha.1",
"@hyperledger/cactus-common": "2.0.0-alpha.1",
"@hyperledger/cactus-core-api": "2.0.0-alpha.1",
Expand All @@ -71,27 +71,13 @@
"zone.js": "0.11.5"
},
"devDependencies": {
"@angular-builders/custom-webpack": "14.1.0",
"@angular-devkit/build-angular": "14.2.12",
"@angular/cli": "14.2.12",
"@angular/compiler": "14.3.0",
"@angular/compiler-cli": "14.3.0",
"@angular/language-service": "14.3.0",
"@ionic/angular-toolkit": "9.0.0",
"@types/node": "17.0.32",
"codelyzer": "6.0.2",
"constants-browserify": "1.0.0",
"jasmine-core": "3.8.0",
"jasmine-spec-reporter": "7.0.0",
"karma": "6.3.19",
"karma-chrome-launcher": "3.1.1",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-jasmine": "5.0.0",
"karma-jasmine-html-reporter": "1.7.0",
"protractor": "7.0.0",
"ts-node": "10.7.0",
"tslint": "6.1.3",
"typescript": "4.6.4"
"@angular-builders/custom-webpack": "15.0.0",
"@angular-devkit/build-angular": "15.2.9",
"@angular/cli": "15.2.9",
"@angular/compiler": "15.2.9",
"@angular/compiler-cli": "15.2.9",
"@angular/language-service": "15.2.9",
"@ionic/angular-toolkit": "9.0.0"
},
"engines": {
"node": ">=10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const routes: Routes = [
imports: [
RouterModule.forRoot(routes, {
preloadingStrategy: PreloadAllModules,
relativeLinkResolution: "legacy",
}),
],
exports: [RouterModule],
Expand Down
5 changes: 3 additions & 2 deletions examples/cactus-example-supply-chain-frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
"moduleResolution": "node",
"esModuleInterop": true,
"importHelpers": true,
"target": "es2020",
"target": "ES2022",
"lib": [
"es2018",
"dom"
],
"resolveJsonModule": true,
"rootDir": "./src",
"skipLibCheck": true,
"tsBuildInfoFile": "../../.build-cache/cactus-example-supply-chain-frontend.tsbuildinfo"
"tsBuildInfoFile": "../../.build-cache/cactus-example-supply-chain-frontend.tsbuildinfo",
"useDefineForClassFields": false
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
Expand Down
3 changes: 2 additions & 1 deletion examples/cactus-example-tcs-huawei/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"composite": true,
"outDir": "./dist/",
"tsBuildInfoFile": "../../.build-cache/cactus-example-electricity-trade.tsbuildinfo",
"rootDir": "./",
"tsBuildInfoFile": "../../.build-cache/cactus-example-tcs-huawei.tsbuildinfo",
"strict": false // TODO - true, fix warnings
},
"include": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
"ts-jest": "28.0.2",
"ts-loader": "9.2.5",
"ts-node": "10.9.1",
"typescript": "4.7.4",
"typescript": "4.8.4",
"webpack": "5.76.0",
"webpack-bundle-analyzer": "4.4.2",
"webpack-cli": "4.7.2",
Expand Down
Loading

0 comments on commit 11c8b11

Please sign in to comment.