mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 16:50:43 +00:00
refactor: remove plugin dependency cleanup leftovers
This commit is contained in:
@@ -16,10 +16,6 @@ const QA_CLI_METADATA_ENTRY_BASENAMES = Object.freeze([
|
||||
"cli-metadata.mjs",
|
||||
"cli-metadata.cjs",
|
||||
]);
|
||||
const QA_RUNTIME_DEPS_ARTIFACT_BASENAMES = new Set([
|
||||
".openclaw-runtime-deps.json",
|
||||
".openclaw-runtime-deps-stamp.json",
|
||||
]);
|
||||
|
||||
function assertSafeQaBundledPluginId(pluginId: string) {
|
||||
if (!QA_BUNDLED_PLUGIN_ID_PATTERN.test(pluginId)) {
|
||||
@@ -316,14 +312,6 @@ async function seedQaStagedBuiltTreeRoots(params: {
|
||||
}
|
||||
}
|
||||
|
||||
function shouldStageQaBundledPluginPath(sourcePath: string) {
|
||||
const basename = path.basename(sourcePath);
|
||||
return (
|
||||
!QA_RUNTIME_DEPS_ARTIFACT_BASENAMES.has(basename) &&
|
||||
!basename.startsWith(".openclaw-runtime-deps-copy-")
|
||||
);
|
||||
}
|
||||
|
||||
export async function resolveQaRuntimeHostVersion(params: {
|
||||
repoRoot: string;
|
||||
allowedPluginIds: readonly string[];
|
||||
@@ -426,10 +414,7 @@ export async function createQaBundledPluginsDir(params: {
|
||||
if (!sourceDir) {
|
||||
throw new Error(`qa bundled plugin not found: ${pluginId}`);
|
||||
}
|
||||
await fs.cp(sourceDir, path.join(bundledPluginsDir, pluginId), {
|
||||
recursive: true,
|
||||
filter: shouldStageQaBundledPluginPath,
|
||||
});
|
||||
await fs.cp(sourceDir, path.join(bundledPluginsDir, pluginId), { recursive: true });
|
||||
}
|
||||
await symlinkQaStagedDirEntry({
|
||||
sourcePath: path.join(stagedRoot, "dist"),
|
||||
|
||||
@@ -934,57 +934,6 @@ describe("qa bundled plugin dir", () => {
|
||||
).resolves.toBeTruthy();
|
||||
});
|
||||
|
||||
it("skips legacy dependency debris while staging built bundled plugins", async () => {
|
||||
const repoRoot = await mkdtemp(path.join(os.tmpdir(), "qa-bundled-legacy-deps-"));
|
||||
cleanups.push(async () => {
|
||||
await rm(repoRoot, { recursive: true, force: true });
|
||||
});
|
||||
await writeFile(
|
||||
path.join(repoRoot, "package.json"),
|
||||
JSON.stringify({ name: "openclaw", type: "module" }, null, 2),
|
||||
"utf8",
|
||||
);
|
||||
const pluginDir = path.join(repoRoot, "dist", "extensions", "qa-channel");
|
||||
await mkdir(path.join(pluginDir, ".openclaw-runtime-deps-copy-active", "node_modules"), {
|
||||
recursive: true,
|
||||
});
|
||||
await writeFile(
|
||||
path.join(pluginDir, "package.json"),
|
||||
JSON.stringify({ name: "@openclaw/qa-channel", type: "module" }, null, 2),
|
||||
"utf8",
|
||||
);
|
||||
await writeFile(path.join(pluginDir, "index.js"), "export const ok = true;\n", "utf8");
|
||||
await writeFile(path.join(pluginDir, ".openclaw-runtime-deps.json"), "{}\n", "utf8");
|
||||
await writeFile(path.join(pluginDir, ".openclaw-runtime-deps-stamp.json"), "{}\n", "utf8");
|
||||
await writeFile(
|
||||
path.join(pluginDir, ".openclaw-runtime-deps-copy-active", "node_modules", "transient.js"),
|
||||
"export {};\n",
|
||||
"utf8",
|
||||
);
|
||||
const tempRoot = await mkdtemp(path.join(os.tmpdir(), "qa-bundled-legacy-deps-target-"));
|
||||
cleanups.push(async () => {
|
||||
await rm(tempRoot, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
const { bundledPluginsDir } = await __testing.createQaBundledPluginsDir({
|
||||
repoRoot,
|
||||
tempRoot,
|
||||
allowedPluginIds: ["qa-channel"],
|
||||
});
|
||||
|
||||
const stagedPluginDir = path.join(bundledPluginsDir, "qa-channel");
|
||||
await expect(readFile(path.join(stagedPluginDir, "index.js"), "utf8")).resolves.toContain("ok");
|
||||
await expect(lstat(path.join(stagedPluginDir, ".openclaw-runtime-deps.json"))).rejects.toThrow(
|
||||
/ENOENT/u,
|
||||
);
|
||||
await expect(
|
||||
lstat(path.join(stagedPluginDir, ".openclaw-runtime-deps-stamp.json")),
|
||||
).rejects.toThrow(/ENOENT/u);
|
||||
await expect(
|
||||
lstat(path.join(stagedPluginDir, ".openclaw-runtime-deps-copy-active")),
|
||||
).rejects.toThrow(/ENOENT/u);
|
||||
});
|
||||
|
||||
it("preserves dist-runtime-only root chunks when dist also exists", async () => {
|
||||
const repoRoot = await mkdtemp(path.join(os.tmpdir(), "qa-bundled-mixed-runtime-"));
|
||||
cleanups.push(async () => {
|
||||
|
||||
Reference in New Issue
Block a user