mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:30:43 +00:00
fix(update): order stable correction releases after base
This commit is contained in:
@@ -29,6 +29,12 @@ describe("compareSemverStrings", () => {
|
||||
expect(compareSemverStrings("1.0.0", "1.0.0.beta.1")).toBe(1);
|
||||
});
|
||||
|
||||
it("treats OpenClaw stable correction releases as newer than their base release", () => {
|
||||
expect(compareSemverStrings("2026.5.3", "2026.5.3-1")).toBe(-1);
|
||||
expect(compareSemverStrings("2026.5.3-1", "2026.5.3")).toBe(1);
|
||||
expect(compareSemverStrings("2026.5.3-2", "2026.5.3-1")).toBe(1);
|
||||
});
|
||||
|
||||
it("returns null for invalid inputs", () => {
|
||||
expect(compareSemverStrings("1.0", "1.0.0")).toBeNull();
|
||||
expect(compareSemverStrings("latest", "1.0.0")).toBeNull();
|
||||
|
||||
@@ -3,6 +3,7 @@ import path from "node:path";
|
||||
import { runCommandWithTimeout } from "../process/exec.js";
|
||||
import { fetchWithTimeout } from "../utils/fetch-timeout.js";
|
||||
import { detectPackageManager as detectPackageManagerImpl } from "./detect-package-manager.js";
|
||||
import { compareOpenClawReleaseVersions } from "./npm-registry-spec.js";
|
||||
import { compareComparableSemver, parseComparableSemver } from "./semver-compare.js";
|
||||
import { channelToNpmTag, type UpdateChannel } from "./update-channels.js";
|
||||
|
||||
@@ -384,6 +385,12 @@ export async function resolveNpmChannelTag(params: {
|
||||
}
|
||||
|
||||
export function compareSemverStrings(a: string | null, b: string | null): number | null {
|
||||
if (a && b) {
|
||||
const openClawReleaseCmp = compareOpenClawReleaseVersions(a, b);
|
||||
if (openClawReleaseCmp != null) {
|
||||
return openClawReleaseCmp;
|
||||
}
|
||||
}
|
||||
return compareComparableSemver(
|
||||
parseComparableSemver(a, { normalizeLegacyDotBeta: true }),
|
||||
parseComparableSemver(b, { normalizeLegacyDotBeta: true }),
|
||||
|
||||
Reference in New Issue
Block a user