btca 0.0.1 → 0.0.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/bin.js +47 -0
- package/dist/btca-darwin-arm64 +0 -0
- package/dist/btca-darwin-x64 +0 -0
- package/dist/btca-linux-arm64 +0 -0
- package/dist/btca-linux-x64 +0 -0
- package/dist/index.js +1777 -4902
- package/package.json +13 -7
package/bin.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
const PLATFORM_ARCH = `${process.platform}-${process.arch}`;
|
|
9
|
+
|
|
10
|
+
const TARGET_MAP = {
|
|
11
|
+
"darwin-arm64": "btca-darwin-arm64",
|
|
12
|
+
"darwin-x64": "btca-darwin-x64",
|
|
13
|
+
"linux-x64": "btca-linux-x64",
|
|
14
|
+
"linux-arm64": "btca-linux-arm64",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const binaryName = TARGET_MAP[PLATFORM_ARCH];
|
|
18
|
+
|
|
19
|
+
if (!binaryName) {
|
|
20
|
+
console.error(
|
|
21
|
+
`[btca] Unsupported platform: ${PLATFORM_ARCH}. ` +
|
|
22
|
+
"Please open an issue with your OS/CPU details."
|
|
23
|
+
);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
28
|
+
const binPath = path.join(__dirname, "dist", binaryName);
|
|
29
|
+
|
|
30
|
+
if (!fs.existsSync(binPath)) {
|
|
31
|
+
console.error(
|
|
32
|
+
`[btca] Prebuilt binary not found for ${PLATFORM_ARCH}. ` +
|
|
33
|
+
"Try reinstalling, or open an issue if the problem persists."
|
|
34
|
+
);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const result = spawnSync(binPath, process.argv.slice(2), {
|
|
39
|
+
stdio: "inherit",
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (result.error) {
|
|
43
|
+
console.error(`[btca] Failed to start binary: ${result.error}`);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
process.exit(result.status ?? 1);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|