mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 20:30:45 +00:00
fix(release): preserve plugin-local runtime deps in postpublish verify
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
rmSync,
|
||||
} from "node:fs";
|
||||
import { builtinModules } from "node:module";
|
||||
import { createRequire } from "node:module";
|
||||
import { tmpdir } from "node:os";
|
||||
import { isAbsolute, join, relative } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
@@ -25,7 +26,6 @@ import {
|
||||
} from "./lib/bundled-plugin-root-runtime-mirrors.mjs";
|
||||
import { runInstalledWorkspaceBootstrapSmoke } from "./lib/workspace-bootstrap-smoke.mjs";
|
||||
import { parseReleaseVersion, resolveNpmCommandInvocation } from "./openclaw-npm-release-check.ts";
|
||||
import { createRequire } from "node:module";
|
||||
|
||||
type InstalledPackageJson = {
|
||||
version?: string;
|
||||
@@ -302,6 +302,8 @@ export function collectInstalledRootDependencyManifestErrors(packageRoot: string
|
||||
];
|
||||
}
|
||||
const missingImporters = new Map<string, Set<string>>();
|
||||
const bundledExtensionRuntimeDependencyOwners =
|
||||
collectBundledExtensionRuntimeDependencyOwners(packageRoot);
|
||||
|
||||
for (const filePath of distFiles) {
|
||||
const fileStat = lstatSync(filePath);
|
||||
@@ -324,7 +326,12 @@ export function collectInstalledRootDependencyManifestErrors(packageRoot: string
|
||||
if (
|
||||
!dependencyName ||
|
||||
NODE_BUILTIN_MODULES.has(dependencyName) ||
|
||||
declaredRuntimeDeps.has(dependencyName)
|
||||
declaredRuntimeDeps.has(dependencyName) ||
|
||||
isBundledExtensionOwnedRuntimeImport({
|
||||
dependencyName,
|
||||
ownersByDependency: bundledExtensionRuntimeDependencyOwners,
|
||||
source,
|
||||
})
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
@@ -342,6 +349,35 @@ export function collectInstalledRootDependencyManifestErrors(packageRoot: string
|
||||
.toSorted((left, right) => left.localeCompare(right));
|
||||
}
|
||||
|
||||
function collectBundledExtensionRuntimeDependencyOwners(
|
||||
packageRoot: string,
|
||||
): Map<string, Set<string>> {
|
||||
const ownersByDependency = new Map<string, Set<string>>();
|
||||
const { manifests } = readBundledExtensionPackageJsons(packageRoot);
|
||||
for (const { id, manifest } of manifests) {
|
||||
for (const dependencyName of collectRuntimeDependencySpecs(manifest).keys()) {
|
||||
const owners = ownersByDependency.get(dependencyName) ?? new Set<string>();
|
||||
owners.add(id);
|
||||
ownersByDependency.set(dependencyName, owners);
|
||||
}
|
||||
}
|
||||
return ownersByDependency;
|
||||
}
|
||||
|
||||
function isBundledExtensionOwnedRuntimeImport(params: {
|
||||
dependencyName: string;
|
||||
ownersByDependency: Map<string, Set<string>>;
|
||||
source: string;
|
||||
}): boolean {
|
||||
const owners = params.ownersByDependency.get(params.dependencyName);
|
||||
if (!owners) {
|
||||
return false;
|
||||
}
|
||||
return [...owners].some((pluginId) =>
|
||||
params.source.includes(`//#region extensions/${pluginId}/`),
|
||||
);
|
||||
}
|
||||
|
||||
export function resolveInstalledBinaryPath(prefixDir: string, platform = process.platform): string {
|
||||
return platform === "win32"
|
||||
? join(prefixDir, "openclaw.cmd")
|
||||
|
||||
Reference in New Issue
Block a user