Files
openclaw/scripts/e2e/lib/package-compat.mjs
qingminlong cb2965ddde fix(scripts): use direct-run helper for Windows guards (#110877)
* fix(scripts): normalize Windows direct-run guards

* test(scripts): cover direct-run routing

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-08-04 23:11:12 +08:00

15 lines
586 B
JavaScript

// Package-version compatibility helpers for E2E acceptance scripts.
import { isDirectRunUrl } from "../../lib/direct-run.mjs";
export function legacyPackageAcceptanceCompat(version) {
const match = /^(\d{4})\.(\d{1,2})\.(\d{1,2})(?:[-+].*)?/.exec(version || "");
const [year, month, day] = match?.slice(1, 4).map(Number) ?? [];
return (
Boolean(match) && (year < 2026 || (year === 2026 && (month < 4 || (month === 4 && day <= 25))))
);
}
if (isDirectRunUrl(process.argv[1], import.meta.url)) {
console.log(legacyPackageAcceptanceCompat(process.argv[2]) ? "1" : "0");
}