Skip to content

Commit ae4ed34

Browse files
committed
chore: update release validate workflow
1 parent 221fc4f commit ae4ed34

File tree

4 files changed

+25
-22
lines changed

4 files changed

+25
-22
lines changed

.github/workflows/release-please-validate.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
- name: Checkout
1616
uses: actions/checkout@v4
1717

18-
- name: Install lerna
19-
run: npm install -g [email protected]
18+
- name: Install glob
19+
run: npm install glob
2020

2121
- name: Ensure Release Please Config and Manifest are in sync with the repository
2222
run: node scripts/check-release-please.mjs

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@
5050
"eslint-plugin-import": "2.27.5",
5151
"eslint-plugin-node": "11.1.0",
5252
"eslint-plugin-prettier": "4.2.1",
53-
"glob": "^10.3.10",
53+
"glob": "^10.4.5",
5454
"lerna-changelog": "2.2.0",
5555
"markdownlint-cli2": "0.13.0",
5656
"minimatch": "^9.0.3",
57-
"nx": "15.9.7",
5857
"mocha": "^10.7.3",
58+
"nx": "15.9.7",
5959
"prettier": "2.8.8",
6060
"process": "0.11.10",
6161
"semver": "^7.6.0",

scripts/check-release-please.mjs

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { strict as assert } from 'assert';
2-
import * as childProcess from 'child_process';
31
import path from 'path';
42
import { readFileSync } from 'fs';
3+
import { globSync } from 'glob';
54

65
/*
76
Enumerates through
@@ -23,28 +22,32 @@ const PROJECT_ROOT = process.cwd();
2322
const readJson = (filePath) => {
2423
return JSON.parse(readFileSync(filePath));
2524
};
26-
const getProcessOutput = (cmd, args) => {
27-
const result = childProcess.spawnSync(cmd, args);
28-
assert(!result.error, result.error);
29-
return result.stdout.toString('utf8');
25+
26+
const getPackages = () => {
27+
const TOP = process.cwd();
28+
const pj = readJson(path.join(TOP, 'package.json'));
29+
return pj.workspaces
30+
.map((wsGlob) => globSync(path.join(wsGlob, 'package.json')))
31+
.flat()
32+
.map((p) => {
33+
const pkgInfo = readJson(p);
34+
pkgInfo.location = path.dirname(p);
35+
pkgInfo.relativeLocation = path.relative(PROJECT_ROOT, pkgInfo.location);
36+
return pkgInfo;
37+
});
3038
}
3139

32-
const lernaList = JSON
33-
.parse(getProcessOutput('npx', ['lerna', 'list', '--json', '-a']))
34-
.map((pkgInfo) => {
35-
pkgInfo.relativeLocation = path.relative(PROJECT_ROOT, pkgInfo.location);
36-
return pkgInfo;
37-
});
40+
const pkgList = getPackages();
3841
const manifest = readJson('.release-please-manifest.json');
3942
const config = readJson('release-please-config.json');
4043

41-
const lernaPackages = new Set(
42-
lernaList.map((pkgInfo) => pkgInfo.relativeLocation)
44+
const packageLocations = new Set(
45+
pkgList.map((pkgInfo) => pkgInfo.relativeLocation)
4346
);
4447
const manifestPackages = new Set(Object.keys(manifest));
4548
const configPackages = new Set(Object.keys(config.packages));
4649

47-
lernaList.forEach((pkgInfo) => {
50+
pkgList.forEach((pkgInfo) => {
4851
const relativeLocation = pkgInfo.relativeLocation
4952
if (pkgInfo.private) {
5053
// Should be in config, with `skip-github-release` option.
@@ -71,14 +74,14 @@ lernaList.forEach((pkgInfo) => {
7174

7275
manifestPackages.forEach((relativeLocation) => {
7376
logErrorIf(
74-
!lernaPackages.has(relativeLocation),
77+
!packageLocations.has(relativeLocation),
7578
`Extraneous path ${relativeLocation} in .release-please-manifest.json`
7679
);
7780
});
7881

7982
configPackages.forEach((relativeLocation) => {
8083
logErrorIf(
81-
!lernaPackages.has(relativeLocation),
84+
!packageLocations.has(relativeLocation),
8285
`Extraneous path ${relativeLocation} in release-please-config.json`
8386
);
8487
});

0 commit comments

Comments
 (0)