@shuyhere/bb-agent 0.0.2 → 0.0.3
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/bin/bb +24 -28
- package/package.json +1 -1
- package/scripts/postinstall.js +1 -1
package/bin/bb
CHANGED
|
@@ -2,46 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
var execFileSync = require("child_process").execFileSync;
|
|
6
|
+
var path = require("path");
|
|
7
|
+
var fs = require("fs");
|
|
8
8
|
|
|
9
9
|
function findBinary() {
|
|
10
|
-
|
|
11
|
-
const nativeBin = path.join(__dirname, "..", "native", "bb");
|
|
10
|
+
var nativeBin = path.join(__dirname, "..", "native", "bb");
|
|
12
11
|
if (fs.existsSync(nativeBin)) {
|
|
13
|
-
try { fs.accessSync(nativeBin, fs.constants.X_OK); return nativeBin; } catch {}
|
|
12
|
+
try { fs.accessSync(nativeBin, fs.constants.X_OK); return nativeBin; } catch (e) {}
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const full = path.join(dir, "bb");
|
|
22
|
-
try { fs.accessSync(full, fs.constants.X_OK); return full; } catch {}
|
|
15
|
+
var dirs = (process.env.PATH || "").split(path.delimiter);
|
|
16
|
+
for (var i = 0; i < dirs.length; i++) {
|
|
17
|
+
if (path.resolve(dirs[i]) === path.resolve(__dirname)) continue;
|
|
18
|
+
var full = path.join(dirs[i], "bb");
|
|
19
|
+
try { fs.accessSync(full, fs.constants.X_OK); return full; } catch (e) {}
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
return null;
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
var binary = findBinary();
|
|
29
26
|
|
|
30
27
|
if (!binary) {
|
|
31
|
-
console.error(
|
|
32
|
-
BB-Agent binary not found.
|
|
33
|
-
|
|
34
|
-
Install Rust (if needed):
|
|
35
|
-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
36
|
-
source ~/.cargo/env
|
|
37
|
-
|
|
38
|
-
Then build BB-Agent:
|
|
39
|
-
git clone https://github.com/shuyhere/bb-agent.git
|
|
40
|
-
cd bb-agent && cargo install --path crates/cli
|
|
41
|
-
|
|
42
|
-
Then run:
|
|
43
|
-
|
|
44
|
-
`;
|
|
28
|
+
console.error("");
|
|
29
|
+
console.error("BB-Agent binary not found.");
|
|
30
|
+
console.error("");
|
|
31
|
+
console.error("Install Rust (if needed):");
|
|
32
|
+
console.error(" curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh");
|
|
33
|
+
console.error(" source ~/.cargo/env");
|
|
34
|
+
console.error("");
|
|
35
|
+
console.error("Then build BB-Agent:");
|
|
36
|
+
console.error(" git clone https://github.com/shuyhere/bb-agent.git");
|
|
37
|
+
console.error(" cd bb-agent && cargo install --path crates/cli");
|
|
38
|
+
console.error("");
|
|
39
|
+
console.error("Then run: bb");
|
|
40
|
+
console.error("");
|
|
45
41
|
process.exit(1);
|
|
46
42
|
}
|
|
47
43
|
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -8,7 +8,7 @@ const path = require("path");
|
|
|
8
8
|
const os = require("os");
|
|
9
9
|
const https = require("https");
|
|
10
10
|
|
|
11
|
-
const VERSION = "0.0.
|
|
11
|
+
const VERSION = "0.0.3";
|
|
12
12
|
const REPO = "shuyhere/bb-agent";
|
|
13
13
|
const NATIVE_DIR = path.join(__dirname, "..", "native");
|
|
14
14
|
const DOWNLOAD_TIMEOUT_MS = 15_000;
|