fix(release): reject staged runtime deps in packs

This commit is contained in:
Peter Steinberger
2026-04-26 09:07:53 +01:00
parent 5c0dc93d1e
commit c99d72575e
8 changed files with 302 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ import { createConnection as createNetConnection, createServer as createNetServe
import { tmpdir } from "node:os";
import { dirname, join, resolve, win32 as pathWin32 } from "node:path";
import { fileURLToPath } from "node:url";
import { assertNoBundledRuntimeDepsStagingDebris } from "../src/infra/package-dist-inventory.ts";
const SCRIPT_PATH = fileURLToPath(import.meta.url);
const PUBLISHED_INSTALLER_BASE_URL = "https://openclaw.ai";
@@ -482,7 +483,8 @@ function isPackagedDistPath(relativePath) {
return true;
}
async function writePackageDistInventoryForCandidate(params) {
export async function writePackageDistInventoryForCandidate(params) {
await assertNoBundledRuntimeDepsStagingDebris(params.sourceDir);
const dryRun = await runCommand(
npmCommand(),
["pack", "--dry-run", "--ignore-scripts", "--json"],

View File

@@ -15,6 +15,7 @@ import { tmpdir } from "node:os";
import { dirname, join, resolve } from "node:path";
import { pathToFileURL } from "node:url";
import {
isBundledRuntimeDepsInstallStagePath,
PACKAGE_DIST_INVENTORY_RELATIVE_PATH,
writePackageDistInventory,
} from "../src/infra/package-dist-inventory.ts";
@@ -585,6 +586,7 @@ export function collectForbiddenPackPaths(paths: Iterable<string>): string[] {
return [...paths]
.filter(
(path) =>
isBundledRuntimeDepsInstallStagePath(path) ||
forbiddenPrefixes.some((prefix) => path.startsWith(prefix)) ||
/(^|\/)\.openclaw-runtime-deps-[^/]+(\/|$)/u.test(path) ||
path.endsWith("/.openclaw-runtime-deps-stamp.json") ||