fix(e2e): strip private ai fixture dev dependencies (#122678)

This commit is contained in:
Vincent Koc
2026-08-13 00:03:48 +08:00
committed by GitHub
parent 71e8cc033b
commit 44335ac7ce
2 changed files with 23 additions and 9 deletions
+4
View File
@@ -53,6 +53,10 @@ function prepare(root) {
fs.rmSync(aiRuntimeTarget, { force: true, recursive: true });
fs.mkdirSync(path.dirname(aiRuntimeTarget), { recursive: true });
fs.renameSync(aiRuntimeSource, aiRuntimeTarget);
const relocatedAiRuntimePackageJson = path.join(aiRuntimeTarget, "package.json");
const relocatedAiRuntimePackage = readJson(relocatedAiRuntimePackageJson);
delete relocatedAiRuntimePackage.devDependencies;
writeJson(relocatedAiRuntimePackageJson, relocatedAiRuntimePackage);
packageJson.dependencies ??= {};
packageJson.dependencies["@openclaw/ai"] = "file:.openclaw-fixture/packages/ai";
+19 -9
View File
@@ -25,7 +25,14 @@ describe("package git fixture", () => {
);
writeFileSync(
path.join(root, "node_modules", "@openclaw", "ai", "package.json"),
`${JSON.stringify({ name: "@openclaw/ai", version: "2026.6.11" })}\n`,
`${JSON.stringify({
name: "@openclaw/ai",
version: "2026.6.11",
type: "module",
main: "./dist/index.mjs",
exports: { ".": "./dist/index.mjs" },
devDependencies: { "@openclaw/normalization-core": "0.0.0-private" },
})}\n`,
);
const result = spawnSync(
@@ -41,14 +48,17 @@ describe("package git fixture", () => {
const packageJson = JSON.parse(readFileSync(path.join(root, "package.json"), "utf8"));
expect(packageJson.dependencies["@openclaw/ai"]).toBe("file:.openclaw-fixture/packages/ai");
expect(packageJson.bundleDependencies).toEqual(["chalk"]);
expect(
JSON.parse(
readFileSync(
path.join(root, ".openclaw-fixture", "packages", "ai", "package.json"),
"utf8",
),
).name,
).toBe("@openclaw/ai");
const relocatedAiPackage = JSON.parse(
readFileSync(path.join(root, ".openclaw-fixture", "packages", "ai", "package.json"), "utf8"),
);
expect(relocatedAiPackage).toMatchObject({
name: "@openclaw/ai",
version: "2026.6.11",
type: "module",
main: "./dist/index.mjs",
exports: { ".": "./dist/index.mjs" },
});
expect(relocatedAiPackage).not.toHaveProperty("devDependencies");
mkdirSync(path.join(root, "node_modules", "chalk"), { recursive: true });
writeFileSync(path.join(root, "node_modules", "chalk", "package.json"), "{}\n");