Skip to content

Commit

Permalink
ci(github): add dependency version consistency check
Browse files Browse the repository at this point in the history
    Primary Changes
    ---------------
    1. Added a new custom check which checks if there
       are any inconsistency with the dependency version,
       which is already being used with an exsisting package.

    Changes needed to incorporate 1)
    -------------------------------
    2. Added a new dependency in the root package.json
    3. Added a new npm script in the root package.json
    4. Updated the lock file for the dependency inclusion

Fixes #3612

Signed-off-by: jagpreetsinghsasan <[email protected]>
  • Loading branch information
jagpreetsinghsasan committed Nov 25, 2024
1 parent 27a24dd commit c6afeb0
Show file tree
Hide file tree
Showing 21 changed files with 352 additions and 1,457 deletions.
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ plugins:
spec: "https://raw.githubusercontent.com/eyolas/yarn-plugin-interractive-filter/master/bundles/%40yarnpkg/plugin-interractive-filter.js"

yarnPath: .yarn/releases/yarn-4.3.1.cjs
enableHardenedMode: false
4 changes: 2 additions & 2 deletions examples/cactus-common-example-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"http-errors": "1.6.3",
"js-yaml": "3.14.1",
"jsonwebtoken": "9.0.2",
"log4js": "6.4.1",
"log4js": "6.9.1",
"morgan": "1.10.0",
"shelljs": "0.8.5",
"socket.io": "4.6.2",
Expand All @@ -81,7 +81,7 @@
"@types/shelljs": "0.8.11",
"http-terminator": "3.2.0",
"lodash": "4.17.21",
"ts-node": "8.9.1"
"ts-node": "10.9.1"
},
"engines": {
"node": ">=18",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"rxjs": "7.8.1",
"tls-browserify": "0.2.2",
"tslib": "2.6.2",
"zone.js": "0.13.1"
"zone.js": "0.14.7"
},
"devDependencies": {
"@angular-builders/custom-webpack": "16.0.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/cactus-example-cbdc-bridging-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"http-status-codes": "2.1.4",
"jose": "4.15.5",
"remix-tests": "0.1.34",
"ts-node": "7.0.1"
"ts-node": "10.9.1"
},
"engines": {
"node": ">=18",
Expand Down
4 changes: 2 additions & 2 deletions examples/cactus-example-cbdc-bridging-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"@types/react": "^18.2.39",
"@types/react-dom": "^18.2.17",
"axios": "1.7.7",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-scripts": "5.0.1",
"typescript": "5.5.2",
"uuid": "10.0.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/cactus-example-discounted-asset-trade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
"indy-sdk": "1.16.0-dev-1655",
"jsonwebtoken": "9.0.2",
"jsrsasign": "11.0.0",
"log4js": "6.4.0",
"morgan": "1.9.1",
"log4js": "6.9.1",
"morgan": "1.10.0",
"run-time-error-cjs": "1.4.0",
"shelljs": "0.8.5",
"socket.io": "4.6.2",
"ts-node": "8.9.1",
"ts-node": "10.9.1",
"uuid": "10.0.0",
"xmlhttprequest": "1.8.0"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/cactus-example-electricity-trade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
"http-errors": "1.6.3",
"js-yaml": "3.14.1",
"jsonwebtoken": "9.0.2",
"log4js": "6.4.0",
"log4js": "6.9.1",
"morgan": "1.9.1",
"shelljs": "0.8.5",
"socket.io": "4.6.2",
"ts-node": "8.9.1",
"ts-node": "10.9.1",
"uuid": "10.0.0",
"web3": "1.8.1",
"xmlhttprequest": "1.8.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/test-run-transaction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"fabric-network": "2.2.20",
"http-errors": "1.6.3",
"jsonwebtoken": "9.0.0",
"log4js": "6.4.0",
"log4js": "6.9.1",
"morgan": "1.9.1",
"shelljs": "0.8.5",
"socket.io": "4.6.2",
Expand Down
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"tools:validate-bundle-names": "TS_NODE_PROJECT=./tools/tsconfig.json node --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/validate-bundle-names.js",
"tools:bump-openapi-spec-dep-versions": "TS_NODE_PROJECT=./tools/tsconfig.json node --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/bump-openapi-spec-dep-versions.ts",
"tools:bundle-open-api-tpl-files": "TS_NODE_PROJECT=./tools/tsconfig.json node --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/bundle-open-api-tpl-files.ts",
"tools:check-dependency-version-consistency": "TS_NODE_PROJECT=./tools/tsconfig.json node --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/custom-checks/check-dependency-version-consistency.ts",
"tools:create-production-only-archive": "TS_NODE_PROJECT=./tools/tsconfig.json node --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/create-production-only-archive.ts",
"tools:download-file-to-disk": "TS_NODE_PROJECT=./tools/tsconfig.json node --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/download-file-to-disk.ts",
"tools:get-latest-sem-ver-git-tag": "TS_NODE_PROJECT=./tools/tsconfig.json node --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node --no-warnings ./tools/get-latest-sem-ver-git-tag.ts",
Expand Down Expand Up @@ -99,21 +100,21 @@
"x-hoek": ">6.1.3",
"http-cache-semantics": ">=4.1.1",
"x-ip": ">2.0.1",
"jsonwebtoken": ">=9.0.0",
"jsrsasign": ">=11.0.0",
"lodash": ">=4.17.21",
"jsonwebtoken": "9.0.2",
"jsrsasign": "11.0.0",
"lodash": "4.17.21",
"x-minimatch": ">=3.0.5",
"minimist": ">=1.2.6",
"minimist": "1.2.8",
"nano": ">=10.0.0",
"node-forge": ">=1.3.0",
"node-forge": "1.3.0",
"nth-check": ">=2.0.1",
"postcss": ">=8.4.31",
"protobufjs": ">=7.2.5",
"semver": ">=7.5.2",
"protobufjs": "7.4.0",
"semver": "7.6.2",
"socket.io-parser": ">=4.2.3",
"tough-cookie": ">=4.1.3",
"underscore": ">=1.13.2",
"vite": ">4.5.1",
"vite": "5.4.8",
"webpack-dev-middleware": ">=6.1.2",
"word-wrap": ">=1.2.5",
"ws": ">=1.1.5",
Expand Down Expand Up @@ -158,6 +159,7 @@
"adm-zip": "0.5.10",
"benchmark": "2.1.4",
"buffer": "6.0.3",
"check-dependency-version-consistency": "4.1.0",
"cpy-cli": "4.2.0",
"cross-env": "7.0.3",
"crypto-browserify": "3.12.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@hyperledger/cactus-core": "2.0.0",
"@hyperledger/cactus-core-api": "2.0.0",
"@hyperledger/cactus-plugin-consortium-manual": "2.0.0",
"jsonwebtoken": "9.0.0",
"jsonwebtoken": "9.0.2",
"rxjs": "7.8.1",
"socket.io-client-fixed-types": "4.5.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"fast-safe-stringify": "2.1.1",
"json-stable-stringify": "1.0.1",
"key-encoder": "2.0.3",
"loglevel": "1.7.1",
"loglevel": "1.8.1",
"loglevel-plugin-prefix": "0.8.4",
"run-time-error-cjs": "1.4.0",
"sanitize-html": "2.12.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-plugin-bungee-hermes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"fs-extra": "11.2.0",
"http-errors-enhanced-cjs": "2.0.1",
"key-encoder": "2.0.3",
"merkletreejs": "0.3.11",
"merkletreejs": "0.4.0",
"typescript-optional": "2.0.1",
"uuid": "10.0.0",
"web3": "1.6.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/cactus-plugin-ledger-connector-polkadot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@
"http-status-codes": "2.1.4",
"joi": "17.13.3",
"multer": "1.4.5-lts.1",
"ngo": "2.6.2",
"ngo": "2.7.0",
"openapi-types": "12.1.3",
"prom-client": "15.1.3",
"run-time-error": "1.4.0",
"temp": "0.9.1",
"temp": "0.9.4",
"tslint": "6.1.3",
"typescript-optional": "2.0.1",
"uuid": "10.0.0"
Expand All @@ -100,7 +100,7 @@
"@types/multer": "1.4.7",
"@types/ssh2": "0.5.44",
"@types/supertest": "2.0.11",
"@types/temp": "0.9.1",
"@types/temp": "0.9.4",
"@types/uuid": "10.0.0",
"supertest": "6.1.6"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-plugin-satp-hermes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"axios": "1.7.7",
"crypto-js": "4.2.0",
"fs-extra": "11.2.0",
"knex": "2.4.0",
"knex": "2.5.1",
"secp256k1": "4.0.3",
"socket.io": "4.6.2",
"sqlite3": "5.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-test-verifier-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@hyperledger/cactus-verifier-client": "2.0.0",
"body-parser": "1.20.3",
"express": "4.21.0",
"log4js": "6.4.1",
"log4js": "6.9.1",
"socket.io": "4.6.2",
"uuid": "10.0.0",
"web3": "1.7.3",
Expand Down
24 changes: 24 additions & 0 deletions tools/custom-checks/check-dependency-version-consistency.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { CDVC } from "check-dependency-version-consistency";
import esMain from "es-main";
import { exit } from "process";

export async function checkDependencyVersionConsistency(): Promise<
[boolean, string[]]
> {
const errors: string[] = [];
const cdvc = new CDVC(process.cwd(), {
fix: false,
});
errors.push(cdvc.toMismatchSummary());
return [errors.length === 0, errors];
}

if (esMain(import.meta)) {
const [success, dependencyMismatchSummary] =
await checkDependencyVersionConsistency();
if (!success) {
console.log(`${dependencyMismatchSummary}`);
exit(1);
}
exit(0);
}
7 changes: 7 additions & 0 deletions tools/custom-checks/run-custom-checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from "./check-missing-node-deps";
import { getAllPkgDirs } from "./get-all-pkg-dirs";
import { runAttwOnTgz } from "./run-attw-on-tgz";
import { checkDependencyVersionConsistency } from "./check-dependency-version-consistency";

export async function runCustomChecks(
argv: string[],
Expand Down Expand Up @@ -74,6 +75,12 @@ export async function runCustomChecks(
overallSuccess = overallSuccess && success;
}

{
const [success, errors] = await checkDependencyVersionConsistency();
overallErrors = overallErrors.concat(errors);
overallSuccess = overallSuccess && success;
}

{
const [success, errors] = await runAttwOnTgz();
overallErrors = overallErrors.concat(errors);
Expand Down
2 changes: 1 addition & 1 deletion weaver/core/identity-management/iin-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"jsrsasign": "11.0.0",
"mocha": "10.7.3",
"nodemon": "2.0.22",
"nyc": "12.0.2",
"nyc": "13.1.0",
"proto3-json-serializer": "1.1.1",
"rewire": "4.0.1",
"sinon": "6.3.5",
Expand Down
2 changes: 1 addition & 1 deletion weaver/sdks/besu/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"mocha": "10.7.3",
"nyc": "12.0.2",
"nyc": "13.1.0",
"rewire": "4.0.1",
"sinon": "6.3.5",
"sinon-chai": "3.7.0",
Expand Down
2 changes: 1 addition & 1 deletion weaver/sdks/fabric/interoperation-node-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"mocha": "10.7.3",
"nyc": "12.0.2",
"nyc": "13.1.0",
"rewire": "4.0.1",
"sinon": "6.3.5",
"sinon-chai": "3.7.0",
Expand Down
Loading

0 comments on commit c6afeb0

Please sign in to comment.