Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,6 @@ jobs:
CI: true
- name: Run check
run: |
node scripts/checkForMultipleVersions.mjs
yarn validate:versions
env:
CI: true
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -65,4 +65,4 @@
},
"name": "packages",
"packageManager": "[email protected]"
}
}
17 changes: 14 additions & 3 deletions scripts/checkForMultipleVersions.mjs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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();
Expand All @@ -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;
}
}
Expand Down
Loading