Skip to content

Commit fdc073b

Browse files
committed
ci: Check package.json 'engines' consistency
This ensures that updates of the 'engines' field in package.json files are consistent across all relevant packages.
1 parent b216061 commit fdc073b

4 files changed

Lines changed: 39 additions & 20 deletions

File tree

.github/workflows/github-ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,28 @@ jobs:
2727
- name: Install dependencies
2828
run: npm ci --engine-strict # --engine-strict is used to fail-fast if deps require node versions unsupported by the repo
2929

30+
- name: Check package.json "engines" consistency
31+
run: |
32+
node << 'EOF'
33+
const { execSync } = require('child_process');
34+
const fs = require('fs');
35+
36+
const rootPkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
37+
const workspaces = JSON.parse(execSync('npm query .workspace --json', { encoding: 'utf8' }));
38+
39+
let hasError = false;
40+
workspaces.forEach(pkg => {
41+
if (JSON.stringify(pkg.engines) !== JSON.stringify(rootPkg.engines)) {
42+
console.error(`❌ ${pkg.location}/package.json "engines" mismatch with root package.json`);
43+
hasError = true;
44+
}
45+
});
46+
47+
if (hasError) process.exit(1);
48+
console.log('✅ All workspace packages "engines" are consistent with root package.json');
49+
50+
EOF
51+
3052
- name: Perform ESLint check
3153
run: npm run lint
3254

internal/benchmark/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
"private": true,
44
"license": "Apache-2.0",
55
"type": "module",
6+
"engines": {
7+
"node": "^22.20.0 || >=24.0.0",
8+
"npm": ">= 8"
9+
},
610
"bin": {
711
"ui5-cli-benchmark": "./cli.js"
812
},

internal/shrinkwrap-extractor/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
"dependencies"
3535
],
3636
"type": "module",
37+
"engines": {
38+
"node": "^22.20.0 || >=24.0.0",
39+
"npm": ">= 8"
40+
},
3741
"dependencies": {
3842
"@npmcli/arborist": "^9.1.7",
3943
"@npmcli/config": "^10.4.0",

package-lock.json

Lines changed: 9 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)