mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 11:58:38 +00:00
fix: ignore prerelease suffixes in release-check plugin version checks
This commit is contained in:
@@ -21,6 +21,10 @@ type PackageJson = {
|
|||||||
version?: string;
|
version?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function normalizePluginSyncVersion(version: string): string {
|
||||||
|
return version.replace(/[-+].*$/, "");
|
||||||
|
}
|
||||||
|
|
||||||
function runPackDry(): PackResult[] {
|
function runPackDry(): PackResult[] {
|
||||||
const raw = execSync("npm pack --dry-run --json --ignore-scripts", {
|
const raw = execSync("npm pack --dry-run --json --ignore-scripts", {
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
@@ -34,8 +38,9 @@ function checkPluginVersions() {
|
|||||||
const rootPackagePath = resolve("package.json");
|
const rootPackagePath = resolve("package.json");
|
||||||
const rootPackage = JSON.parse(readFileSync(rootPackagePath, "utf8")) as PackageJson;
|
const rootPackage = JSON.parse(readFileSync(rootPackagePath, "utf8")) as PackageJson;
|
||||||
const targetVersion = rootPackage.version;
|
const targetVersion = rootPackage.version;
|
||||||
|
const targetBaseVersion = targetVersion ? normalizePluginSyncVersion(targetVersion) : null;
|
||||||
|
|
||||||
if (!targetVersion) {
|
if (!targetVersion || !targetBaseVersion) {
|
||||||
console.error("release-check: root package.json missing version.");
|
console.error("release-check: root package.json missing version.");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
@@ -60,13 +65,15 @@ function checkPluginVersions() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pkg.version !== targetVersion) {
|
if (normalizePluginSyncVersion(pkg.version) !== targetBaseVersion) {
|
||||||
mismatches.push(`${pkg.name} (${pkg.version})`);
|
mismatches.push(`${pkg.name} (${pkg.version})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mismatches.length > 0) {
|
if (mismatches.length > 0) {
|
||||||
console.error(`release-check: plugin versions must match ${targetVersion}:`);
|
console.error(
|
||||||
|
`release-check: plugin versions must match release base ${targetBaseVersion} (root ${targetVersion}):`,
|
||||||
|
);
|
||||||
for (const item of mismatches) {
|
for (const item of mismatches) {
|
||||||
console.error(` - ${item}`);
|
console.error(` - ${item}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user