@manaflow-ai/cloudrouter 0.8.0 → 0.9.1
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/lib/{cmux → cloudrouter} +0 -0
- package/lib/postinstall.js +20 -11
- package/package.json +13 -9
- package/bin/cloudrouter +0 -60
package/lib/{cmux → cloudrouter}
RENAMED
|
Binary file
|
package/lib/postinstall.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Post-install script for
|
|
3
|
+
* Post-install script for cloudrouter
|
|
4
4
|
* Copies the platform-specific binary to the bin directory
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -19,6 +19,7 @@ function getPlatformPackage() {
|
|
|
19
19
|
const platform = process.platform;
|
|
20
20
|
const arch = process.arch;
|
|
21
21
|
|
|
22
|
+
// Map Node.js arch to our naming
|
|
22
23
|
let archName = arch;
|
|
23
24
|
if (arch === 'x64') archName = 'x64';
|
|
24
25
|
else if (arch === 'arm64') archName = 'arm64';
|
|
@@ -28,17 +29,20 @@ function getPlatformPackage() {
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
function findBinary(packageName) {
|
|
31
|
-
const binName = process.platform === 'win32' ? '
|
|
32
|
+
const binName = process.platform === 'win32' ? 'cloudrouter.exe' : 'cloudrouter';
|
|
33
|
+
// Extract the short name for scoped package paths
|
|
34
|
+
const shortName = packageName.replace('@manaflow-ai/', '');
|
|
32
35
|
|
|
36
|
+
// Try to find the binary in node_modules
|
|
33
37
|
const possiblePaths = [
|
|
34
|
-
// Hoisted to top-level node_modules (local install)
|
|
35
|
-
path.join(__dirname, '..', '..',
|
|
36
|
-
// In our own node_modules
|
|
37
|
-
path.join(__dirname, '..', 'node_modules',
|
|
38
|
-
// Global install - sibling package
|
|
39
|
-
path.join(__dirname, '..', '..', '..',
|
|
40
|
-
// pnpm global
|
|
41
|
-
path.join(__dirname, '..', '..', '.pnpm', 'node_modules',
|
|
38
|
+
// Hoisted to top-level node_modules (local install) - scoped
|
|
39
|
+
path.join(__dirname, '..', '..', '@manaflow-ai', shortName, 'bin'),
|
|
40
|
+
// In our own node_modules - scoped
|
|
41
|
+
path.join(__dirname, '..', 'node_modules', '@manaflow-ai', shortName, 'bin'),
|
|
42
|
+
// Global install - sibling package - scoped
|
|
43
|
+
path.join(__dirname, '..', '..', '..', '@manaflow-ai', shortName, 'bin'),
|
|
44
|
+
// pnpm global - scoped
|
|
45
|
+
path.join(__dirname, '..', '..', '.pnpm', 'node_modules', '@manaflow-ai', shortName, 'bin'),
|
|
42
46
|
];
|
|
43
47
|
|
|
44
48
|
// Also try require.resolve to find the package
|
|
@@ -72,21 +76,26 @@ function main() {
|
|
|
72
76
|
const sourceBinary = findBinary(platformPackage);
|
|
73
77
|
|
|
74
78
|
if (!sourceBinary) {
|
|
79
|
+
// Binary not found - try to install the platform package
|
|
75
80
|
console.error(`cloudrouter: Platform package ${platformPackage} not found`);
|
|
76
81
|
console.error(`cloudrouter: Please ensure the package installed correctly.`);
|
|
77
82
|
console.error(`cloudrouter: You can try: npm install -g ${platformPackage}`);
|
|
83
|
+
// Don't exit with error - npm might still be installing optional deps
|
|
78
84
|
return;
|
|
79
85
|
}
|
|
80
86
|
|
|
81
87
|
const binDir = path.join(__dirname, '..', 'bin');
|
|
82
|
-
const destBinary = path.join(binDir, process.platform === 'win32' ? '
|
|
88
|
+
const destBinary = path.join(binDir, process.platform === 'win32' ? 'cloudrouter.exe' : 'cloudrouter');
|
|
83
89
|
|
|
90
|
+
// Ensure bin directory exists
|
|
84
91
|
if (!fs.existsSync(binDir)) {
|
|
85
92
|
fs.mkdirSync(binDir, { recursive: true });
|
|
86
93
|
}
|
|
87
94
|
|
|
95
|
+
// Copy the binary
|
|
88
96
|
fs.copyFileSync(sourceBinary, destBinary);
|
|
89
97
|
|
|
98
|
+
// Make executable on Unix
|
|
90
99
|
if (process.platform !== 'win32') {
|
|
91
100
|
fs.chmodSync(destBinary, 0o755);
|
|
92
101
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manaflow-ai/cloudrouter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "CLI tool to instantly spin up cloud VMs preloaded with Chrome, VNC, SSH, and rsync",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -8,16 +8,20 @@
|
|
|
8
8
|
"cloud",
|
|
9
9
|
"sandbox",
|
|
10
10
|
"development",
|
|
11
|
-
"
|
|
12
|
-
"morph",
|
|
11
|
+
"cloudrouter",
|
|
13
12
|
"vscode",
|
|
14
13
|
"vnc"
|
|
15
14
|
],
|
|
16
15
|
"homepage": "https://cmux.sh",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/manaflow-ai/cloudrouter.git"
|
|
19
|
+
},
|
|
17
20
|
"license": "MIT",
|
|
18
21
|
"author": "Manaflow",
|
|
19
22
|
"bin": {
|
|
20
|
-
"cloudrouter": "bin/cloudrouter"
|
|
23
|
+
"cloudrouter": "bin/cloudrouter",
|
|
24
|
+
"cr": "bin/cloudrouter"
|
|
21
25
|
},
|
|
22
26
|
"files": [
|
|
23
27
|
"bin",
|
|
@@ -27,11 +31,11 @@
|
|
|
27
31
|
"postinstall": "node lib/postinstall.js"
|
|
28
32
|
},
|
|
29
33
|
"optionalDependencies": {
|
|
30
|
-
"@manaflow-ai/cloudrouter-darwin-arm64": "0.
|
|
31
|
-
"@manaflow-ai/cloudrouter-darwin-x64": "0.
|
|
32
|
-
"@manaflow-ai/cloudrouter-linux-arm64": "0.
|
|
33
|
-
"@manaflow-ai/cloudrouter-linux-x64": "0.
|
|
34
|
-
"@manaflow-ai/cloudrouter-win32-x64": "0.
|
|
34
|
+
"@manaflow-ai/cloudrouter-darwin-arm64": "0.9.1",
|
|
35
|
+
"@manaflow-ai/cloudrouter-darwin-x64": "0.9.1",
|
|
36
|
+
"@manaflow-ai/cloudrouter-linux-arm64": "0.9.1",
|
|
37
|
+
"@manaflow-ai/cloudrouter-linux-x64": "0.9.1",
|
|
38
|
+
"@manaflow-ai/cloudrouter-win32-x64": "0.9.1"
|
|
35
39
|
},
|
|
36
40
|
"engines": {
|
|
37
41
|
"node": ">=16"
|
package/bin/cloudrouter
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* cloudrouter CLI wrapper - delegates to the native cmux 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" ? "cmux.exe" : "cmux";
|
|
16
|
-
|
|
17
|
-
// Look for the native binary in these locations (in order)
|
|
18
|
-
const candidates = [
|
|
19
|
-
// lib/cmux - 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
|
-
// Unscoped fallback paths for hoisted installs
|
|
33
|
-
path.join(__dirname, "..", "..", "..", ".store", pkgName, "bin", binName),
|
|
34
|
-
];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
let binaryPath;
|
|
38
|
-
for (const candidate of candidates) {
|
|
39
|
-
if (fs.existsSync(candidate)) {
|
|
40
|
-
binaryPath = candidate;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (!binaryPath) {
|
|
46
|
-
console.error("cloudrouter: Could not find native binary. Try reinstalling: npm install -g @manaflow-ai/cloudrouter");
|
|
47
|
-
process.exit(1);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
execFileSync(binaryPath, process.argv.slice(2), {
|
|
52
|
-
stdio: "inherit",
|
|
53
|
-
env: process.env,
|
|
54
|
-
});
|
|
55
|
-
} catch (err) {
|
|
56
|
-
if (err.status !== null) {
|
|
57
|
-
process.exit(err.status);
|
|
58
|
-
}
|
|
59
|
-
throw err;
|
|
60
|
-
}
|