mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-24 11:29:31 +00:00
chore(deadcode): remove unused plugin version validator
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
// Bundled Extension Manifest script supports OpenClaw repository automation.
|
||||
import { validateMinHostVersion } from "../../src/plugins/min-host-version.ts";
|
||||
import {
|
||||
MIN_HOST_VERSION_FORMAT,
|
||||
parseMinHostVersionRequirement,
|
||||
} from "../../src/plugins/min-host-version.ts";
|
||||
import { isRecord } from "../../src/utils.js";
|
||||
|
||||
export type ExtensionPackageJson = {
|
||||
@@ -35,7 +38,11 @@ export function collectBundledExtensionManifestErrors(extensions: BundledExtensi
|
||||
`bundled extension '${extension.id}' manifest invalid | openclaw.install.npmSpec must be a non-empty string`,
|
||||
);
|
||||
}
|
||||
const minHostVersionError = validateMinHostVersion(install?.minHostVersion);
|
||||
const minHostVersionError =
|
||||
install?.minHostVersion === undefined ||
|
||||
parseMinHostVersionRequirement(install.minHostVersion)
|
||||
? null
|
||||
: MIN_HOST_VERSION_FORMAT;
|
||||
if (minHostVersionError) {
|
||||
errors.push(`bundled extension '${extension.id}' manifest invalid | ${minHostVersionError}`);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
checkMinHostVersion,
|
||||
MIN_HOST_VERSION_FORMAT,
|
||||
parseMinHostVersionRequirement,
|
||||
validateMinHostVersion,
|
||||
} from "./min-host-version.js";
|
||||
|
||||
const MIN_HOST_REQUIREMENT = {
|
||||
@@ -40,8 +39,7 @@ function expectHostCheckResult(params: {
|
||||
).toEqual(params.expected);
|
||||
}
|
||||
|
||||
function expectInvalidMinHostVersion(minHostVersion: string | number) {
|
||||
expect(validateMinHostVersion(minHostVersion)).toBe(MIN_HOST_VERSION_FORMAT);
|
||||
function expectInvalidHostCheck(minHostVersion: string | number) {
|
||||
expectHostCheckResult({
|
||||
currentVersion: "2026.3.22",
|
||||
minHostVersion,
|
||||
@@ -55,7 +53,6 @@ function expectInvalidMinHostVersion(minHostVersion: string | number) {
|
||||
|
||||
describe("min-host-version", () => {
|
||||
it("accepts empty metadata", () => {
|
||||
expect(validateMinHostVersion(undefined)).toBeNull();
|
||||
expect(parseMinHostVersionRequirement(undefined)).toBeNull();
|
||||
expectValidHostCheck("2026.3.22");
|
||||
});
|
||||
@@ -92,7 +89,7 @@ describe("min-host-version", () => {
|
||||
it.each(["2026.3.22", 123, ">=2026.3.22 garbage"] as const)(
|
||||
"rejects invalid floor syntax and host checks: %p",
|
||||
(minHostVersion) => {
|
||||
expectInvalidMinHostVersion(minHostVersion);
|
||||
expectInvalidHostCheck(minHostVersion);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -56,14 +56,6 @@ export function parseMinHostVersionRequirement(
|
||||
};
|
||||
}
|
||||
|
||||
/** Validates a plugin minHostVersion manifest field for schema/reporting callers. */
|
||||
export function validateMinHostVersion(raw: unknown): string | null {
|
||||
if (raw === undefined) {
|
||||
return null;
|
||||
}
|
||||
return parseMinHostVersionRequirement(raw) ? null : MIN_HOST_VERSION_FORMAT;
|
||||
}
|
||||
|
||||
/** Checks whether the current host satisfies a plugin minHostVersion requirement. */
|
||||
export function checkMinHostVersion(params: {
|
||||
currentVersion: string | undefined;
|
||||
|
||||
Reference in New Issue
Block a user