Skip to content

Commit 9f9b6e7

Browse files
authored
Merge pull request #1321 from nrkno/fix/release-scripts
fix(release scripts): improve release scripts (SOFIE-3572)
2 parents 1478b68 + 9636051 commit 9f9b6e7

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

.github/workflows/node.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,6 @@ jobs:
748748
CI: true
749749
- name: Run check
750750
run: |
751-
node scripts/checkForMultipleVersions.mjs
751+
yarn validate:versions
752752
env:
753753
CI: true

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
"meteor:run": "cd meteor && meteor yarn start",
2626
"lint": "run lint:meteor && run lint:packages",
2727
"unit": "run unit:meteor && run unit:packages",
28-
"validate:release": "yarn install && run install-and-build && run validate:release:packages && run validate:release:meteor",
28+
"validate:release": "yarn install && run install-and-build && run validate:versions && run validate:release:packages && run validate:release:meteor",
2929
"validate:release:meteor": "cd meteor && meteor yarn validate:prod-dependencies && meteor yarn license-validate && meteor yarn lint && meteor yarn test",
3030
"validate:release:packages": "cd packages && run validate:dependencies && run test",
31+
"validate:versions": "node scripts/checkForMultipleVersions.mjs",
3132
"meteor": "cd meteor && meteor",
3233
"docs:serve": "cd packages && run docs:serve",
3334
"reset": "node scripts/reset.mjs",

packages/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"build": "lerna run build --ignore @sofie-automation/openapi",
1818
"build:try": "lerna run --no-bail build --ignore @sofie-automation/openapi",
1919
"watch": "lerna run --parallel build:main --ignore @sofie-automation/openapi -- --watch --preserveWatchOutput",
20-
"stage-versions": "git add -u */package.json */CHANGELOG.md lerna.json yarn.lock",
20+
"stage-versions": "git add -u \"*/package.json\" \"*/CHANGELOG.md\" lerna.json yarn.lock",
2121
"set-version": "lerna version --exact --no-changelog --no-git-tag-version --no-push --yes",
2222
"set-version-and-commit": "lerna version --exact --no-changelog --no-changelog --no-commit-hooks --force-publish='*' --no-push --yes",
2323
"set-version-and-changelog": "lerna version --exact --force-publish --conventional-commits --no-git-tag-version --no-push --yes",
@@ -65,4 +65,4 @@
6565
},
6666
"name": "packages",
6767
"packageManager": "[email protected]"
68-
}
68+
}

scripts/checkForMultipleVersions.mjs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { buildDepTreeFromFiles } from "snyk-nodejs-lockfile-parser";
22

3+
function hr() {
4+
// write regular dashes if this is a "simple" output stream ()
5+
if (!process.stdout.hasColors || !process.stdout.hasColors())
6+
return "-".repeat(process.stdout.columns ?? 40);
7+
return '─'.repeat(process.stdout.columns ?? 40)
8+
}
9+
310
/**
411
* These are the libs we want to consider.
512
* 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");
5865

5966
let hasFailure = false;
6067

68+
console.log(hr())
69+
console.log(" 🔢 Checking dependency version consistency...")
70+
console.log(hr())
71+
6172
// check each library
6273
for (const libName of libsToConsider) {
6374
const allVersions = new Set();
@@ -73,11 +84,11 @@ for (const libName of libsToConsider) {
7384
// output some info
7485
const str = Array.from(allVersions).join(", ");
7586
if (allVersions.size === 0) {
76-
console.log(`No versions of "${nameStr}" installed`);
87+
console.log(`No versions of "${nameStr}" installed`);
7788
} else if (allVersions.size === 1) {
78-
console.log(`Single version of "${nameStr}" installed: ${str}`);
89+
console.log(`Single version of "${nameStr}" installed: ${str}`);
7990
} else {
80-
console.error(`Multiple versions of "${nameStr}" installed: ${str}`);
91+
console.error(`⚠️ Multiple versions of "${nameStr}" installed: ${str}`);
8192
hasFailure = true;
8293
}
8394
}

0 commit comments

Comments
 (0)