mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-02 19:31:37 +00:00
* fix(memory): survive Homebrew Node upgrades Co-authored-by: 袁龙辉0668001277 <yuan.longhui@xydigit.com> * test(whatsapp): isolate last-route coverage * fix(deepinfra): preserve offline model compatibility * test(memory): isolate migration cleanup lifecycle * test: stabilize aggregate extension gates * ci: retrigger pull request workflow * test: preserve inherited Node options * test(cli): tolerate cold hosted startup --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
26 lines
960 B
TypeScript
26 lines
960 B
TypeScript
import path from "node:path";
|
|
import { expectDefined } from "./expect.js";
|
|
|
|
/**
|
|
* Returns stable Homebrew paths for a versioned Cellar Node executable.
|
|
* Availability remains caller-owned so packages can reuse the path contract
|
|
* without importing another package's filesystem/runtime layer.
|
|
*/
|
|
export function stableHomebrewNodePathCandidates(nodePath: string): string[] {
|
|
const cellarMatch = nodePath.match(
|
|
/^(.+?)[\\/]Cellar[\\/]([^\\/]+)[\\/][^\\/]+[\\/]bin[\\/]node$/,
|
|
);
|
|
if (!cellarMatch) {
|
|
return [];
|
|
}
|
|
|
|
const prefix = expectDefined(cellarMatch[1], "cellar match capture group 1");
|
|
const formula = expectDefined(cellarMatch[2], "cellar match capture group 2");
|
|
const pathModule = nodePath.includes("\\") ? path.win32 : path.posix;
|
|
const candidates = [pathModule.join(prefix, "opt", formula, "bin", "node")];
|
|
if (formula === "node") {
|
|
candidates.push(pathModule.join(prefix, "bin", "node"));
|
|
}
|
|
return candidates;
|
|
}
|