reallink-cli 0.1.1 → 0.1.6
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/README.md +36 -1
- package/bin/reallink.cjs +41 -6
- package/package.json +3 -1
- package/rust/Cargo.lock +133 -1
- package/rust/Cargo.toml +2 -1
- package/rust/src/main.rs +1294 -25
- package/scripts/postinstall.cjs +37 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require("node:child_process");
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
|
|
6
|
+
const packageRoot = path.resolve(__dirname, "..");
|
|
7
|
+
const manifestPath = path.join(packageRoot, "rust", "Cargo.toml");
|
|
8
|
+
const binaryName = process.platform === "win32" ? "reallink-cli.exe" : "reallink-cli";
|
|
9
|
+
const releaseBinaryPath = path.join(packageRoot, "rust", "target", "release", binaryName);
|
|
10
|
+
|
|
11
|
+
if (process.env.REALLINK_SKIP_BUILD === "1") {
|
|
12
|
+
process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (fs.existsSync(releaseBinaryPath)) {
|
|
16
|
+
process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const build = spawnSync(
|
|
20
|
+
"cargo",
|
|
21
|
+
["build", "--release", "--manifest-path", manifestPath],
|
|
22
|
+
{
|
|
23
|
+
stdio: "inherit",
|
|
24
|
+
shell: process.platform === "win32"
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
if (build.error) {
|
|
29
|
+
console.error(
|
|
30
|
+
`reallink-cli postinstall failed: ${build.error.message}\n` +
|
|
31
|
+
"Rust toolchain is required for npm installation. " +
|
|
32
|
+
"Install Rust (https://rustup.rs) or use the hosted installer at https://real-agent.link/install.sh."
|
|
33
|
+
);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
process.exit(build.status ?? 1);
|