mirror of https://github.com/openclaw/openclaw.git
fix: ignore prerelease suffixes in release-check plugin version checks
This commit is contained in:
parent
e93ba6ce2a
commit
74e6c210c0
|
|
@ -21,6 +21,10 @@ type PackageJson = {
|
|||
version?: string;
|
||||
};
|
||||
|
||||
function normalizePluginSyncVersion(version: string): string {
|
||||
return version.replace(/[-+].*$/, "");
|
||||
}
|
||||
|
||||
function runPackDry(): PackResult[] {
|
||||
const raw = execSync("npm pack --dry-run --json --ignore-scripts", {
|
||||
encoding: "utf8",
|
||||
|
|
@ -34,8 +38,9 @@ function checkPluginVersions() {
|
|||
const rootPackagePath = resolve("package.json");
|
||||
const rootPackage = JSON.parse(readFileSync(rootPackagePath, "utf8")) as PackageJson;
|
||||
const targetVersion = rootPackage.version;
|
||||
const targetBaseVersion = targetVersion ? normalizePluginSyncVersion(targetVersion) : null;
|
||||
|
||||
if (!targetVersion) {
|
||||
if (!targetVersion || !targetBaseVersion) {
|
||||
console.error("release-check: root package.json missing version.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
@ -60,13 +65,15 @@ function checkPluginVersions() {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (pkg.version !== targetVersion) {
|
||||
if (normalizePluginSyncVersion(pkg.version) !== targetBaseVersion) {
|
||||
mismatches.push(`${pkg.name} (${pkg.version})`);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
console.error(` - ${item}`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue