@syengup/friday-channel-next 0.1.7 → 0.1.8
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.
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
1
|
+
import { existsSync, readdirSync, realpathSync } from "node:fs";
|
|
2
|
+
import { delimiter, dirname, join } from "node:path";
|
|
4
3
|
let cache = null;
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
function resolveOpenClawDistFromPath() {
|
|
5
|
+
// Walk PATH looking for the openclaw binary, then resolve its real
|
|
6
|
+
// location to find the dist/ directory. No shell commands needed.
|
|
7
|
+
const binName = process.platform === "win32" ? "openclaw.cmd" : "openclaw";
|
|
8
|
+
const pathDirs = (process.env.PATH ?? "").split(delimiter);
|
|
9
|
+
for (const dir of pathDirs) {
|
|
10
|
+
const candidate = join(dir, binName);
|
|
11
|
+
if (!existsSync(candidate))
|
|
12
|
+
continue;
|
|
13
|
+
try {
|
|
14
|
+
const real = realpathSync(candidate);
|
|
15
|
+
const dist = join(dirname(real), "dist");
|
|
16
|
+
readdirSync(dist);
|
|
17
|
+
return dist;
|
|
18
|
+
}
|
|
19
|
+
catch { }
|
|
19
20
|
}
|
|
21
|
+
return null;
|
|
20
22
|
}
|
|
21
23
|
function resolveOpenClawDist() {
|
|
22
24
|
// Priority order:
|
|
23
25
|
// 1. OPENCLAW_DIST env var (explicit override, works everywhere)
|
|
24
26
|
// 2. Resolve the `openclaw` binary on PATH → dist/ (robust, cross-platform)
|
|
25
27
|
// 3. Platform-specific standard install paths
|
|
26
|
-
const fromBin =
|
|
28
|
+
const fromBin = resolveOpenClawDistFromPath();
|
|
27
29
|
const candidates = [
|
|
28
30
|
process.env.OPENCLAW_DIST,
|
|
29
31
|
fromBin,
|
package/package.json
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
1
|
+
import { existsSync, readdirSync, realpathSync } from "node:fs";
|
|
2
|
+
import { delimiter, dirname, join } from "node:path";
|
|
4
3
|
|
|
5
4
|
let cache: { listNodePairing: Function; approveNodePairing: Function } | null = null;
|
|
6
5
|
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
function resolveOpenClawDistFromPath(): string | null {
|
|
7
|
+
// Walk PATH looking for the openclaw binary, then resolve its real
|
|
8
|
+
// location to find the dist/ directory. No shell commands needed.
|
|
9
|
+
const binName = process.platform === "win32" ? "openclaw.cmd" : "openclaw";
|
|
10
|
+
const pathDirs = (process.env.PATH ?? "").split(delimiter);
|
|
11
|
+
for (const dir of pathDirs) {
|
|
12
|
+
const candidate = join(dir, binName);
|
|
13
|
+
if (!existsSync(candidate)) continue;
|
|
14
|
+
try {
|
|
15
|
+
const real = realpathSync(candidate);
|
|
16
|
+
const dist = join(dirname(real), "dist");
|
|
17
|
+
readdirSync(dist);
|
|
18
|
+
return dist;
|
|
19
|
+
} catch {}
|
|
19
20
|
}
|
|
21
|
+
return null;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
function resolveOpenClawDist(): string {
|
|
@@ -24,7 +26,7 @@ function resolveOpenClawDist(): string {
|
|
|
24
26
|
// 1. OPENCLAW_DIST env var (explicit override, works everywhere)
|
|
25
27
|
// 2. Resolve the `openclaw` binary on PATH → dist/ (robust, cross-platform)
|
|
26
28
|
// 3. Platform-specific standard install paths
|
|
27
|
-
const fromBin =
|
|
29
|
+
const fromBin = resolveOpenClawDistFromPath();
|
|
28
30
|
const candidates: string[] = [
|
|
29
31
|
process.env.OPENCLAW_DIST,
|
|
30
32
|
fromBin,
|