fix: exclude qa extensions from npm package

This commit is contained in:
Peter Steinberger
2026-04-22 22:45:50 +01:00
parent ebe32e5cee
commit e56a6f87ec
9 changed files with 21 additions and 36 deletions

View File

@@ -52,7 +52,6 @@ const providerConfig = {
};
const PACKAGE_DIST_INVENTORY_RELATIVE_PATH = "dist/postinstall-inventory.json";
const PACKAGED_QA_RUNTIME_PATHS = new Set(["dist/extensions/qa-channel/runtime-api.js"]);
const OMITTED_QA_EXTENSION_PREFIXES = [
"dist/extensions/qa-channel/",
"dist/extensions/qa-lab/",
@@ -478,7 +477,7 @@ function isPackagedDistPath(relativePath) {
return false;
}
if (OMITTED_QA_EXTENSION_PREFIXES.some((prefix) => relativePath.startsWith(prefix))) {
return PACKAGED_QA_RUNTIME_PATHS.has(relativePath);
return false;
}
return true;
}

View File

@@ -59,14 +59,9 @@ export type NpmDistTagMirrorAuth = {
};
const EXPECTED_REPOSITORY_URL = "https://github.com/openclaw/openclaw";
const MAX_CALVER_DISTANCE_DAYS = 2;
const LEGACY_UPDATE_COMPAT_PACKED_PATHS = [
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
] as const;
const REQUIRED_PACKED_PATHS = [
PACKAGE_DIST_INVENTORY_RELATIVE_PATH,
"dist/control-ui/index.html",
...LEGACY_UPDATE_COMPAT_PACKED_PATHS,
...WORKSPACE_TEMPLATE_PACK_PATHS,
];
const CONTROL_UI_ASSET_PREFIX = "dist/control-ui/assets/";
@@ -104,6 +99,7 @@ const FORBIDDEN_PACKED_PATH_RULES = [
] as const;
const FORBIDDEN_PRIVATE_QA_CONTENT_MARKERS = [
"//#region extensions/qa-lab/",
"qa-channel/runtime-api.js",
"qa-lab/cli.js",
"qa-lab/runtime-api.js",
] as const;
@@ -532,9 +528,6 @@ function collectPackedTarballErrors(): string[] {
export function collectForbiddenPackedPathErrors(paths: Iterable<string>): string[] {
const errors: string[] = [];
for (const packedPath of paths) {
if ((LEGACY_UPDATE_COMPAT_PACKED_PATHS as readonly string[]).includes(packedPath)) {
continue;
}
const matchedRule = FORBIDDEN_PACKED_PATH_RULES.find((rule) =>
packedPath.startsWith(rule.prefix),
);

View File

@@ -66,16 +66,11 @@ const requiredPathGroups = [
"dist/build-info.json",
"dist/channel-catalog.json",
"dist/control-ui/index.html",
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
];
const legacyUpdateCompatPackPaths = new Set([
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
]);
const forbiddenPrefixes = [
"dist-runtime/",
"dist/OpenClaw.app/",
"dist/extensions/qa-channel/",
"dist/extensions/qa-lab/",
"dist/plugin-sdk/extensions/qa-lab/",
"dist/plugin-sdk/qa-lab.",
@@ -89,6 +84,7 @@ const forbiddenPrefixes = [
];
const forbiddenPrivateQaContentMarkers = [
"//#region extensions/qa-lab/",
"qa-channel/runtime-api.js",
"qa-lab/cli.js",
"qa-lab/runtime-api.js",
] as const;
@@ -460,9 +456,7 @@ export function collectForbiddenPackPaths(paths: Iterable<string>): string[] {
return [...paths]
.filter(
(path) =>
!legacyUpdateCompatPackPaths.has(path) &&
(forbiddenPrefixes.some((prefix) => path.startsWith(prefix)) ||
/node_modules\//.test(path)),
forbiddenPrefixes.some((prefix) => path.startsWith(prefix)) || /node_modules\//.test(path),
)
.toSorted((left, right) => left.localeCompare(right));
}