@a2hmarket/a2hmarket 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/install.mjs +25 -20
package/package.json
CHANGED
package/scripts/install.mjs
CHANGED
|
@@ -302,30 +302,35 @@ async function main() {
|
|
|
302
302
|
try {
|
|
303
303
|
const pluginDir = join(OPENCLAW_DIR, "extensions", "a2hmarket");
|
|
304
304
|
if (existsSync(pluginDir)) {
|
|
305
|
-
// Find openclaw package
|
|
305
|
+
// Find openclaw package — resolve from the actual binary location
|
|
306
306
|
let openclawPkg = null;
|
|
307
|
-
const candidates = [];
|
|
308
307
|
try {
|
|
309
|
-
//
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
308
|
+
// Follow symlinks to find the real openclaw.mjs, then derive the package root
|
|
309
|
+
const realBin = execSync("realpath $(which openclaw) 2>/dev/null || readlink -f $(which openclaw) 2>/dev/null", { encoding: "utf-8" }).trim();
|
|
310
|
+
if (realBin) {
|
|
311
|
+
// openclaw.mjs is at {pkg}/openclaw.mjs or {pkg}/dist/cli/...
|
|
312
|
+
// Walk up until we find package.json with name "openclaw"
|
|
313
|
+
let dir = realBin;
|
|
314
|
+
for (let i = 0; i < 5; i++) {
|
|
315
|
+
dir = join(dir, "..");
|
|
316
|
+
const pj = join(dir, "package.json");
|
|
317
|
+
if (existsSync(pj)) {
|
|
318
|
+
try {
|
|
319
|
+
const pkg = JSON.parse(readFileSync(pj, "utf-8"));
|
|
320
|
+
if (pkg.name === "openclaw") { openclawPkg = dir; break; }
|
|
321
|
+
} catch {}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
319
324
|
}
|
|
320
325
|
} catch {}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
break;
|
|
326
|
+
|
|
327
|
+
// Fallback: try common paths
|
|
328
|
+
if (!openclawPkg) {
|
|
329
|
+
for (const p of [
|
|
330
|
+
"/opt/homebrew/lib/node_modules/openclaw",
|
|
331
|
+
"/usr/local/lib/node_modules/openclaw",
|
|
332
|
+
]) {
|
|
333
|
+
if (existsSync(join(p, "package.json"))) { openclawPkg = p; break; }
|
|
329
334
|
}
|
|
330
335
|
}
|
|
331
336
|
|