@manaflow-ai/cloudrouter 0.9.1 → 0.9.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/cloudrouter +58 -0
- package/lib/cloudrouter +0 -0
- package/package.json +1 -1
package/bin/cloudrouter
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* cloudrouter CLI wrapper - delegates to the native binary.
|
|
4
|
+
*
|
|
5
|
+
* This script exists so npm can create a proper bin symlink at install time.
|
|
6
|
+
* The postinstall script will overwrite this file with the platform-specific
|
|
7
|
+
* native binary. If postinstall hasn't run yet, this wrapper finds and
|
|
8
|
+
* executes the binary from lib/ or the platform package.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const { execFileSync } = require("child_process");
|
|
12
|
+
const path = require("path");
|
|
13
|
+
const fs = require("fs");
|
|
14
|
+
|
|
15
|
+
const binName = process.platform === "win32" ? "cloudrouter.exe" : "cloudrouter";
|
|
16
|
+
|
|
17
|
+
// Look for the native binary in these locations (in order)
|
|
18
|
+
const candidates = [
|
|
19
|
+
// lib/cloudrouter - copied by build process as fallback
|
|
20
|
+
path.join(__dirname, "..", "lib", binName),
|
|
21
|
+
// Platform package in node_modules (hoisted)
|
|
22
|
+
...getPlatformPaths(),
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
function getPlatformPaths() {
|
|
26
|
+
const platform = process.platform;
|
|
27
|
+
const arch = process.arch;
|
|
28
|
+
const pkgName = `@manaflow-ai/cloudrouter-${platform}-${arch}`;
|
|
29
|
+
return [
|
|
30
|
+
path.join(__dirname, "..", "..", pkgName, "bin", binName),
|
|
31
|
+
path.join(__dirname, "..", "node_modules", pkgName, "bin", binName),
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let binaryPath;
|
|
36
|
+
for (const candidate of candidates) {
|
|
37
|
+
if (fs.existsSync(candidate)) {
|
|
38
|
+
binaryPath = candidate;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!binaryPath) {
|
|
44
|
+
console.error("cloudrouter: Could not find native binary. Try reinstalling: npm install -g @manaflow-ai/cloudrouter");
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const result = execFileSync(binaryPath, process.argv.slice(2), {
|
|
50
|
+
stdio: "inherit",
|
|
51
|
+
env: process.env,
|
|
52
|
+
});
|
|
53
|
+
} catch (err) {
|
|
54
|
+
if (err.status !== null) {
|
|
55
|
+
process.exit(err.status);
|
|
56
|
+
}
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
package/lib/cloudrouter
CHANGED
|
Binary file
|