openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
18 lines (17 loc) • 1.02 kB
JavaScript
import { d as realpathOrResolve } from "../path-existence-Co7-GyVr.mjs";
import { l as pathExists } from "../utils-C8YECn2Q.mjs";
import { m as resolvePnpmGlobalInstallOwner, s as inferPnpmGlobalRootFromPackageRoot } from "../update-global-EYvKtjUB.mjs";
import path from "node:path";
//#region src/infra/update-global-pnpm-retired.ts
async function isRetiredPnpmGenerationOfInstall(e) {
const t = path.resolve(e.entrypoint).split(path.sep);
const n = t.lastIndexOf(".pnpm");
if (n <= 0 || t[n - 1] !== "node_modules" || !t[n + 1]?.startsWith("openclaw@") || t[n + 2] !== "node_modules" || t[n + 3] !== "openclaw") return false;
const r = t.slice(0, n + 4).join(path.sep);
const i = inferPnpmGlobalRootFromPackageRoot(r);
const a = inferPnpmGlobalRootFromPackageRoot(e.activeRoot);
if (!i || !a || await pathExists(r) || !await resolvePnpmGlobalInstallOwner(e.activeRoot)) return false;
return await realpathOrResolve(i) === await realpathOrResolve(a);
}
//#endregion
export { isRetiredPnpmGenerationOfInstall };