diff --git a/package.json b/package.json index 860cd0543f..8ad27f0e2d 100644 --- a/package.json +++ b/package.json @@ -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", @@ -315,5 +316,8 @@ "built": false } }, - "packageManager": "yarn@4.3.1" + "packageManager": "yarn@4.3.1", + "dependencies": { + "check-dependency-version-consistency": "4.1.0" + } } diff --git a/tools/custom-checks/check-dependency-version-consistency.ts b/tools/custom-checks/check-dependency-version-consistency.ts new file mode 100644 index 0000000000..57f4b43f4c --- /dev/null +++ b/tools/custom-checks/check-dependency-version-consistency.ts @@ -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); +} \ No newline at end of file diff --git a/tools/custom-checks/run-custom-checks.ts b/tools/custom-checks/run-custom-checks.ts index 0f292e30e5..14834e2773 100644 --- a/tools/custom-checks/run-custom-checks.ts +++ b/tools/custom-checks/run-custom-checks.ts @@ -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[], @@ -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); @@ -91,4 +98,4 @@ export async function runCustomChecks( if (esMain(import.meta)) { runCustomChecks(process.argv, process.env, process.versions.node); -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 3e367b4193..c12d02960c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11147,6 +11147,7 @@ __metadata: adm-zip: "npm:0.5.10" benchmark: "npm:2.1.4" buffer: "npm:6.0.3" + check-dependency-version-consistency: "npm:4.1.0" cpy-cli: "npm:4.2.0" cross-env: "npm:7.0.3" crypto-browserify: "npm:3.12.0" @@ -17235,6 +17236,13 @@ __metadata: languageName: node linkType: hard +"@types/js-yaml@npm:^4.0.5": + version: 4.0.9 + resolution: "@types/js-yaml@npm:4.0.9" + checksum: 10/a0ce595db8a987904badd21fc50f9f444cb73069f4b95a76cc222e0a17b3ff180669059c763ec314bc4c3ce284379177a9da80e83c5f650c6c1310cafbfaa8e6 + languageName: node + linkType: hard + "@types/json-schema@npm:*, @types/json-schema@npm:^7.0.8": version: 7.0.9 resolution: "@types/json-schema@npm:7.0.9" @@ -19550,7 +19558,7 @@ __metadata: languageName: node linkType: hard -"ajv@npm:8.17.1, ajv@npm:^8.10.0, ajv@npm:^8.14.0": +"ajv@npm:8.17.1, ajv@npm:^8.0.1, ajv@npm:^8.10.0, ajv@npm:^8.14.0": version: 8.17.1 resolution: "ajv@npm:8.17.1" dependencies: @@ -22853,6 +22861,25 @@ __metadata: languageName: node linkType: hard +"check-dependency-version-consistency@npm:4.1.0": + version: 4.1.0 + resolution: "check-dependency-version-consistency@npm:4.1.0" + dependencies: + "@types/js-yaml": "npm:^4.0.5" + chalk: "npm:^5.2.0" + commander: "npm:^10.0.1" + edit-json-file: "npm:^1.7.0" + globby: "npm:^13.1.4" + js-yaml: "npm:^4.1.0" + semver: "npm:^7.5.1" + table: "npm:^6.8.1" + type-fest: "npm:^3.11.0" + bin: + check-dependency-version-consistency: dist/bin/check-dependency-version-consistency.js + checksum: 10/8ee74466e317f0c8e3ddff366882818122057c311ffbf4377ec5f09e0cbf9fdbdb79abafcf017ebcc498a3dd2b268a41015c1a80a0f8b3f2c36b1000113b1eff + languageName: node + linkType: hard + "check-error@npm:^1.0.2": version: 1.0.2 resolution: "check-error@npm:1.0.2" @@ -26636,6 +26663,19 @@ __metadata: languageName: node linkType: hard +"edit-json-file@npm:^1.7.0": + version: 1.8.0 + resolution: "edit-json-file@npm:1.8.0" + dependencies: + find-value: "npm:^1.0.12" + iterate-object: "npm:^1.3.4" + r-json: "npm:^1.2.10" + set-value: "npm:^4.1.0" + w-json: "npm:^1.3.10" + checksum: 10/611e62414a15b1d6e44261d1fd370fa6f080f4a93ff6ee4ec0b103a545984dbb0aa8a68f2c7856cbb63948c2c2df6b2b12d98140d3e040f3ce12cffdc51de7a3 + languageName: node + linkType: hard + "ee-first@npm:1.1.1": version: 1.1.1 resolution: "ee-first@npm:1.1.1" @@ -30272,6 +30312,13 @@ __metadata: languageName: node linkType: hard +"find-value@npm:^1.0.12": + version: 1.0.12 + resolution: "find-value@npm:1.0.12" + checksum: 10/5cab63c88e5090744de582c8c331c05b134f3501935da270f24c95b395c4fea3e7d0df5e9cfdd6c2a25b80ac7cde3bc06d6dd388e4fdc6cd52f6580ed95e14e1 + languageName: node + linkType: hard + "findit@npm:^2.0.0": version: 2.0.0 resolution: "findit@npm:2.0.0" @@ -31726,7 +31773,7 @@ __metadata: languageName: node linkType: hard -"globby@npm:^13.1.2": +"globby@npm:^13.1.2, globby@npm:^13.1.4": version: 13.2.2 resolution: "globby@npm:13.2.2" dependencies: @@ -34433,6 +34480,13 @@ __metadata: languageName: node linkType: hard +"is-primitive@npm:^3.0.1": + version: 3.0.1 + resolution: "is-primitive@npm:3.0.1" + checksum: 10/c4da6a6e6d487f31d85b9259b67695fffcc75dca6c9612b0a002e3050c734227b9911be09b877539ec6309710229c19f4edd0f9e26ed2a67924ee0916baf0bed + languageName: node + linkType: hard + "is-promise@npm:^2.1.0": version: 2.2.2 resolution: "is-promise@npm:2.2.2" @@ -35194,6 +35248,13 @@ __metadata: languageName: node linkType: hard +"iterate-object@npm:^1.3.4": + version: 1.3.4 + resolution: "iterate-object@npm:1.3.4" + checksum: 10/4378555000600ec749f82c85323232a12d533491ea1168de6249f2105cefd0c6a30df9fc2c5bfdc47f6386d0c920e99b2c49a58e2e0ec8f19342bee69ba05905 + languageName: node + linkType: hard + "iterator.prototype@npm:^1.1.2": version: 1.1.2 resolution: "iterator.prototype@npm:1.1.2" @@ -38278,6 +38339,13 @@ __metadata: languageName: node linkType: hard +"lodash.truncate@npm:^4.4.2": + version: 4.4.2 + resolution: "lodash.truncate@npm:4.4.2" + checksum: 10/7a495616121449e5d2288c606b1025d42ab9979e8c93ba885e5c5802ffd4f1ebad4428c793ccc12f73e73237e85a9f5b67dd6415757546fbd5a4653ba83e25ac + languageName: node + linkType: hard + "lodash.uniq@npm:^4.5.0": version: 4.5.0 resolution: "lodash.uniq@npm:4.5.0" @@ -45501,6 +45569,15 @@ __metadata: languageName: node linkType: hard +"r-json@npm:^1.2.10": + version: 1.3.0 + resolution: "r-json@npm:1.3.0" + dependencies: + w-json: "npm:1.3.10" + checksum: 10/ebe24b41e9f855af9f61747d7f3a511a78bc11c1841eaf3cbf98b385e91a0a982a3f724e2bf24d737642efc9b510585b5c54d25c098cc6850bdad15a22b36636 + languageName: node + linkType: hard + "race-signal@npm:^1.0.0": version: 1.0.1 resolution: "race-signal@npm:1.0.1" @@ -48296,6 +48373,16 @@ __metadata: languageName: node linkType: hard +"set-value@npm:^4.1.0": + version: 4.1.0 + resolution: "set-value@npm:4.1.0" + dependencies: + is-plain-object: "npm:^2.0.4" + is-primitive: "npm:^3.0.1" + checksum: 10/67eebb0d78be89242478daf8ab5357c59a35add1d7bdccdb56236e6004128a79bdf298c952e286b60b63ed17b24dcdb399734fbdacc9b76e7fd2e3e01546a42e + languageName: node + linkType: hard + "setimmediate@npm:1.0.4": version: 1.0.4 resolution: "setimmediate@npm:1.0.4" @@ -50548,6 +50635,19 @@ __metadata: languageName: node linkType: hard +"table@npm:^6.8.1": + version: 6.9.0 + resolution: "table@npm:6.9.0" + dependencies: + ajv: "npm:^8.0.1" + lodash.truncate: "npm:^4.4.2" + slice-ansi: "npm:^4.0.0" + string-width: "npm:^4.2.3" + strip-ansi: "npm:^6.0.1" + checksum: 10/976da6d89841566e39628d1ba107ffab126964c9390a0a877a7c54ebb08820bf388d28fe9f8dcf354b538f19634a572a506c38a3762081640013a149cc862af9 + languageName: node + linkType: hard + "tablemark@npm:^3.0.0": version: 3.0.0 resolution: "tablemark@npm:3.0.0" @@ -52045,7 +52145,7 @@ __metadata: languageName: node linkType: hard -"type-fest@npm:^3.8.0": +"type-fest@npm:^3.11.0, type-fest@npm:^3.8.0": version: 3.13.1 resolution: "type-fest@npm:3.13.1" checksum: 10/9a8a2359ada34c9b3affcaf3a8f73ee14c52779e89950db337ce66fb74c3399776c697c99f2532e9b16e10e61cfdba3b1c19daffb93b338b742f0acd0117ce12 @@ -53319,6 +53419,13 @@ __metadata: languageName: node linkType: hard +"w-json@npm:1.3.10, w-json@npm:^1.3.10": + version: 1.3.10 + resolution: "w-json@npm:1.3.10" + checksum: 10/bf3dfa4e8e2429fcf2b0456ba396245a0be719ff4fb04eec971536c3586cae7489c5ca5801848ecfbc2a454f37829a132f428acf9d457cebe43d5c70348e7a7b + languageName: node + linkType: hard + "w3c-hr-time@npm:^1.0.2": version: 1.0.2 resolution: "w3c-hr-time@npm:1.0.2"