@aptove/bridge 0.1.7 → 0.1.8
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/bridge +24 -51
- package/package.json +6 -6
- package/postinstall.js +26 -39
package/bin/bridge
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* bridge - ACP bridge
|
|
5
|
-
*
|
|
6
|
-
* This script finds and executes the platform-specific binary.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const { execFileSync } = require('child_process');
|
|
3
|
+
const { spawnSync } = require('child_process');
|
|
10
4
|
const path = require('path');
|
|
11
5
|
const fs = require('fs');
|
|
12
6
|
|
|
@@ -18,56 +12,35 @@ const PLATFORM_PACKAGES = {
|
|
|
18
12
|
'win32-x64': '@aptove/bridge-win32-x64',
|
|
19
13
|
};
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const packageName = PLATFORM_PACKAGES[platformKey];
|
|
24
|
-
|
|
25
|
-
if (!packageName) {
|
|
26
|
-
console.error(`Unsupported platform: ${platformKey}`);
|
|
27
|
-
console.error('Supported platforms: darwin-arm64, darwin-x64, linux-arm64, linux-x64, win32-x64');
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const binaryName = process.platform === 'win32' ? 'bridge.exe' : 'bridge';
|
|
15
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
16
|
+
const packageName = PLATFORM_PACKAGES[platformKey];
|
|
32
17
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
18
|
+
if (!packageName) {
|
|
19
|
+
console.error(`bridge: unsupported platform ${platformKey}`);
|
|
20
|
+
console.error('Supported: darwin-arm64, darwin-x64, linux-arm64, linux-x64, win32-x64');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
38
23
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return binaryPath;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
24
|
+
const binaryName = process.platform === 'win32' ? 'bridge.exe' : 'bridge';
|
|
25
|
+
let binaryPath;
|
|
44
26
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
} catch (e) {
|
|
52
|
-
// Package not found
|
|
27
|
+
try {
|
|
28
|
+
const packageJsonPath = require.resolve(`${packageName}/package.json`);
|
|
29
|
+
const candidate = path.join(path.dirname(packageJsonPath), 'bin', binaryName);
|
|
30
|
+
if (fs.existsSync(candidate)) {
|
|
31
|
+
binaryPath = candidate;
|
|
53
32
|
}
|
|
33
|
+
} catch (e) {
|
|
34
|
+
// package not installed
|
|
35
|
+
}
|
|
54
36
|
|
|
55
|
-
|
|
56
|
-
console.error(`
|
|
37
|
+
if (!binaryPath) {
|
|
38
|
+
console.error(`bridge: platform package not installed for ${platformKey}`);
|
|
57
39
|
console.error('');
|
|
58
|
-
console.error('
|
|
59
|
-
console.error(
|
|
40
|
+
console.error('Run:');
|
|
41
|
+
console.error(` npm install -g ${packageName}`);
|
|
60
42
|
process.exit(1);
|
|
61
43
|
}
|
|
62
44
|
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
execFileSync(binaryPath, args, { stdio: 'inherit' });
|
|
68
|
-
} catch (error) {
|
|
69
|
-
if (error.status !== undefined) {
|
|
70
|
-
process.exit(error.status);
|
|
71
|
-
}
|
|
72
|
-
throw error;
|
|
73
|
-
}
|
|
45
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
46
|
+
process.exit(result.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptove/bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "ACP bridge — connects ACP agents to mobile and desktop clients over WebSocket",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"node": ">=16"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@aptove/bridge-darwin-arm64": "0.1.
|
|
37
|
-
"@aptove/bridge-darwin-x64": "0.1.
|
|
38
|
-
"@aptove/bridge-linux-arm64": "0.1.
|
|
39
|
-
"@aptove/bridge-linux-x64": "0.1.
|
|
40
|
-
"@aptove/bridge-win32-x64": "0.1.
|
|
36
|
+
"@aptove/bridge-darwin-arm64": "0.1.8",
|
|
37
|
+
"@aptove/bridge-darwin-x64": "0.1.8",
|
|
38
|
+
"@aptove/bridge-linux-arm64": "0.1.8",
|
|
39
|
+
"@aptove/bridge-linux-x64": "0.1.8",
|
|
40
|
+
"@aptove/bridge-win32-x64": "0.1.8"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/postinstall.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* bridge postinstall script
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Checks whether the platform-specific binary package was installed.
|
|
5
|
+
* npm sometimes skips optional dependencies during global installs.
|
|
6
|
+
* If so, prints the exact command to complete installation.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
|
-
const { execSync } = require('child_process');
|
|
9
9
|
const path = require('path');
|
|
10
10
|
const fs = require('fs');
|
|
11
11
|
|
|
@@ -17,44 +17,31 @@ const PLATFORM_PACKAGES = {
|
|
|
17
17
|
'win32-x64': '@aptove/bridge-win32-x64',
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const packageName = PLATFORM_PACKAGES[platformKey];
|
|
20
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
21
|
+
const packageName = PLATFORM_PACKAGES[platformKey];
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
const packagePath = require.resolve(`${packageName}/package.json`);
|
|
32
|
-
const binaryName = process.platform === 'win32' ? 'bridge.exe' : 'bridge';
|
|
33
|
-
const binaryPath = path.join(path.dirname(packagePath), 'bin', binaryName);
|
|
34
|
-
|
|
35
|
-
if (!fs.existsSync(binaryPath)) {
|
|
36
|
-
console.warn(`⚠️ bridge: Binary not found at ${binaryPath}`);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
23
|
+
if (!packageName) {
|
|
24
|
+
console.warn(`⚠️ bridge: unsupported platform ${platformKey}`);
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
39
27
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
fs.chmodSync(binaryPath, 0o755);
|
|
43
|
-
} catch (e) {
|
|
44
|
-
// Not critical
|
|
45
|
-
}
|
|
46
|
-
}
|
|
28
|
+
const binaryName = process.platform === 'win32' ? 'bridge.exe' : 'bridge';
|
|
29
|
+
let installed = false;
|
|
47
30
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} catch (e) {
|
|
55
|
-
console.warn(`⚠️ bridge: Platform package ${packageName} not installed`);
|
|
56
|
-
console.warn(' This is expected on CI or unsupported platforms');
|
|
57
|
-
}
|
|
31
|
+
try {
|
|
32
|
+
const packageJsonPath = require.resolve(`${packageName}/package.json`);
|
|
33
|
+
const binaryPath = path.join(path.dirname(packageJsonPath), 'bin', binaryName);
|
|
34
|
+
installed = fs.existsSync(binaryPath);
|
|
35
|
+
} catch (e) {
|
|
36
|
+
// package not installed
|
|
58
37
|
}
|
|
59
38
|
|
|
60
|
-
|
|
39
|
+
if (installed) {
|
|
40
|
+
console.log(`✓ bridge installed successfully for ${platformKey}`);
|
|
41
|
+
} else {
|
|
42
|
+
console.log('');
|
|
43
|
+
console.log(`⚠️ bridge: platform binary not found (npm skipped optional dependency)`);
|
|
44
|
+
console.log(` To complete installation, run:`);
|
|
45
|
+
console.log(` npm install -g ${packageName}`);
|
|
46
|
+
console.log('');
|
|
47
|
+
}
|