diff --git a/.github/workflows/node.yaml b/.github/workflows/node.yaml index fb50334747..ae6d82fd6f 100644 --- a/.github/workflows/node.yaml +++ b/.github/workflows/node.yaml @@ -748,6 +748,6 @@ jobs: CI: true - name: Run check run: | - node scripts/checkForMultipleVersions.mjs + yarn validate:versions env: CI: true diff --git a/package.json b/package.json index e232a83b9f..ac8dc02608 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,10 @@ "meteor:run": "cd meteor && meteor yarn start", "lint": "run lint:meteor && run lint:packages", "unit": "run unit:meteor && run unit:packages", - "validate:release": "yarn install && run install-and-build && run validate:release:packages && run validate:release:meteor", + "validate:release": "yarn install && run install-and-build && run validate:versions && run validate:release:packages && run validate:release:meteor", "validate:release:meteor": "cd meteor && meteor yarn validate:prod-dependencies && meteor yarn license-validate && meteor yarn lint && meteor yarn test", "validate:release:packages": "cd packages && run validate:dependencies && run test", + "validate:versions": "node scripts/checkForMultipleVersions.mjs", "meteor": "cd meteor && meteor", "docs:serve": "cd packages && run docs:serve", "reset": "node scripts/reset.mjs", diff --git a/packages/package.json b/packages/package.json index c379c53211..b38fcdc147 100644 --- a/packages/package.json +++ b/packages/package.json @@ -17,7 +17,7 @@ "build": "lerna run build --ignore @sofie-automation/openapi", "build:try": "lerna run --no-bail build --ignore @sofie-automation/openapi", "watch": "lerna run --parallel build:main --ignore @sofie-automation/openapi -- --watch --preserveWatchOutput", - "stage-versions": "git add -u */package.json */CHANGELOG.md lerna.json yarn.lock", + "stage-versions": "git add -u \"*/package.json\" \"*/CHANGELOG.md\" lerna.json yarn.lock", "set-version": "lerna version --exact --no-changelog --no-git-tag-version --no-push --yes", "set-version-and-commit": "lerna version --exact --no-changelog --no-changelog --no-commit-hooks --force-publish='*' --no-push --yes", "set-version-and-changelog": "lerna version --exact --force-publish --conventional-commits --no-git-tag-version --no-push --yes", @@ -65,4 +65,4 @@ }, "name": "packages", "packageManager": "yarn@3.5.0" -} +} \ No newline at end of file diff --git a/scripts/checkForMultipleVersions.mjs b/scripts/checkForMultipleVersions.mjs index b633852235..792aee1f79 100644 --- a/scripts/checkForMultipleVersions.mjs +++ b/scripts/checkForMultipleVersions.mjs @@ -1,5 +1,12 @@ import { buildDepTreeFromFiles } from "snyk-nodejs-lockfile-parser"; +function hr() { + // write regular dashes if this is a "simple" output stream () + if (!process.stdout.hasColors || !process.stdout.hasColors()) + return "-".repeat(process.stdout.columns ?? 40); + return '─'.repeat(process.stdout.columns ?? 40) +} + /** * These are the libs we want to consider. * Its an array of arrays, to allow for multiple names to be treated as one package @@ -58,6 +65,10 @@ await addDepsForRoot("./packages", "live-status-gateway"); let hasFailure = false; +console.log(hr()) +console.log(" 🔢 Checking dependency version consistency...") +console.log(hr()) + // check each library for (const libName of libsToConsider) { const allVersions = new Set(); @@ -73,11 +84,11 @@ for (const libName of libsToConsider) { // output some info const str = Array.from(allVersions).join(", "); if (allVersions.size === 0) { - console.log(`No versions of "${nameStr}" installed`); + console.log(`❔ No versions of "${nameStr}" installed`); } else if (allVersions.size === 1) { - console.log(`Single version of "${nameStr}" installed: ${str}`); + console.log(`✅ Single version of "${nameStr}" installed: ${str}`); } else { - console.error(`Multiple versions of "${nameStr}" installed: ${str}`); + console.error(`⚠️ Multiple versions of "${nameStr}" installed: ${str}`); hasFailure = true; } }