build: restore qa lab updater sidecar

This commit is contained in:
Peter Steinberger
2026-04-17 00:42:52 +01:00
parent 0c5bdbde89
commit 26db52ed69
12 changed files with 83 additions and 21 deletions

View File

@@ -4,6 +4,11 @@ export const NPM_UPDATE_COMPAT_SIDECARS = [
content:
"// Compatibility stub for older OpenClaw updaters. The QA channel implementation is not packaged.\nexport {};\n",
},
{
path: "dist/extensions/qa-lab/runtime-api.js",
content:
"// Compatibility stub for older OpenClaw updaters. The QA lab implementation is not packaged.\nexport {};\n",
},
] as const;
export const NPM_UPDATE_COMPAT_SIDECAR_PATHS = new Set<string>(

View File

@@ -37,14 +37,22 @@ describe("package dist inventory", () => {
it("keeps npm-omitted dist artifacts out of the inventory", async () => {
await withTempDir({ prefix: "openclaw-dist-inventory-pack-" }, async (packageRoot) => {
const packagedQaRuntime = path.join(
const packagedQaChannelRuntime = path.join(
packageRoot,
"dist",
"extensions",
"qa-channel",
"runtime-api.js",
);
const packagedQaLabRuntime = path.join(
packageRoot,
"dist",
"extensions",
"qa-lab",
"runtime-api.js",
);
const omittedQaChunk = path.join(packageRoot, "dist", "extensions", "qa-channel", "cli.js");
const omittedQaLabChunk = path.join(packageRoot, "dist", "extensions", "qa-lab", "cli.js");
const omittedQaMatrixChunk = path.join(
packageRoot,
"dist",
@@ -72,13 +80,16 @@ describe("package dist inventory", () => {
"color-support",
);
const omittedMap = path.join(packageRoot, "dist", "feature.runtime.js.map");
await fs.mkdir(path.dirname(packagedQaRuntime), { recursive: true });
await fs.mkdir(path.dirname(packagedQaChannelRuntime), { recursive: true });
await fs.mkdir(path.dirname(packagedQaLabRuntime), { recursive: true });
await fs.mkdir(path.dirname(omittedQaMatrixChunk), { recursive: true });
await fs.mkdir(path.dirname(omittedQaLabTypes), { recursive: true });
await fs.mkdir(path.dirname(omittedExtensionNodeModuleSymlink), { recursive: true });
await fs.writeFile(path.join(packageRoot, "color-support.js"), "export {};\n", "utf8");
await fs.writeFile(packagedQaRuntime, "export {};\n", "utf8");
await fs.writeFile(packagedQaChannelRuntime, "export {};\n", "utf8");
await fs.writeFile(packagedQaLabRuntime, "export {};\n", "utf8");
await fs.writeFile(omittedQaChunk, "export {};\n", "utf8");
await fs.writeFile(omittedQaLabChunk, "export {};\n", "utf8");
await fs.writeFile(omittedQaMatrixChunk, "export {};\n", "utf8");
await fs.writeFile(omittedQaLabPluginSdk, "export {};\n", "utf8");
await fs.writeFile(omittedQaLabTypes, "export {};\n", "utf8");
@@ -91,6 +102,7 @@ describe("package dist inventory", () => {
await expect(writePackageDistInventory(packageRoot)).resolves.toEqual([
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
]);
});
});

View File

@@ -2,7 +2,10 @@ import fs from "node:fs/promises";
import path from "node:path";
export 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 PACKAGED_QA_RUNTIME_PATHS = new Set([
"dist/extensions/qa-channel/runtime-api.js",
"dist/extensions/qa-lab/runtime-api.js",
]);
const OMITTED_QA_EXTENSION_PREFIXES = [
"dist/extensions/qa-channel/",
"dist/extensions/qa-lab/",
@@ -20,7 +23,6 @@ const OMITTED_PRIVATE_QA_PLUGIN_SDK_FILES = new Set([
const OMITTED_PRIVATE_QA_DIST_PREFIXES = ["dist/qa-runtime-"];
const OMITTED_DIST_SUBTREE_PATTERNS = [
/^dist\/extensions\/[^/]+\/node_modules(?:\/|$)/u,
/^dist\/extensions\/qa-lab(?:\/|$)/u,
/^dist\/extensions\/qa-matrix(?:\/|$)/u,
/^dist\/plugin-sdk\/extensions\/qa-lab(?:\/|$)/u,
] as const;

View File

@@ -32,6 +32,7 @@ import {
const MATRIX_HELPER_API = bundledDistPluginFile("matrix", "helper-api.js");
const QA_CHANNEL_RUNTIME_API = bundledDistPluginFile("qa-channel", "runtime-api.js");
const QA_LAB_RUNTIME_API = bundledDistPluginFile("qa-lab", "runtime-api.js");
describe("update global helpers", () => {
let envSnapshot: ReturnType<typeof captureEnv> | undefined;
@@ -427,6 +428,12 @@ describe("update global helpers", () => {
await expect(collectInstalledGlobalPackageErrors({ packageRoot })).resolves.toContain(
`missing bundled runtime sidecar ${QA_CHANNEL_RUNTIME_API}`,
);
await fs.writeFile(path.join(packageRoot, QA_CHANNEL_RUNTIME_API), "export {};\n", "utf-8");
await fs.rm(path.join(packageRoot, QA_LAB_RUNTIME_API));
await expect(collectInstalledGlobalPackageErrors({ packageRoot })).resolves.toContain(
`missing bundled runtime sidecar ${QA_LAB_RUNTIME_API}`,
);
});
});