@botmobile/botmobile-openclaw 0.0.9 → 0.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botmobile/botmobile-openclaw",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "OpenClaw BotMobile mobile bridge plugin (private test build)",
5
5
  "type": "module",
6
6
  "files": [
@@ -1,30 +1,30 @@
1
1
  import { execSync } from "node:child_process";
2
- import { createRequire } from "node:module";
3
2
  import { dirname, join } from "node:path";
4
- import { existsSync } from "node:fs";
3
+ import { existsSync, writeFileSync } from "node:fs";
4
+ import { fileURLToPath } from "node:url";
5
5
 
6
- const require = createRequire(import.meta.url);
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
7
+ const pluginRoot = join(__dirname, "..");
7
8
 
8
- // Check if the native binary already exists
9
- let ndcDir;
10
- try {
11
- ndcDir = dirname(require.resolve("node-datachannel/package.json"));
12
- } catch {
13
- // node-datachannel not installed at all — nothing we can do here
14
- console.error("[botmobile] node-datachannel package not found in node_modules");
9
+ // Write marker so we can verify postinstall ran
10
+ writeFileSync(join(pluginRoot, ".postinstall-ran"), new Date().toISOString());
11
+
12
+ const ndcDir = join(pluginRoot, "node_modules", "node-datachannel");
13
+
14
+ if (!existsSync(ndcDir)) {
15
+ console.error("[botmobile:postinstall] node-datachannel not found at", ndcDir);
15
16
  process.exit(1);
16
17
  }
17
18
 
18
19
  const binaryPath = join(ndcDir, "build", "Release", "node_datachannel.node");
19
20
 
20
21
  if (existsSync(binaryPath)) {
21
- // Binary exists, all good
22
+ console.log("[botmobile:postinstall] native binary already exists");
22
23
  process.exit(0);
23
24
  }
24
25
 
25
- console.log("[botmobile] node-datachannel native binary not found, running prebuild-install…");
26
+ console.log("[botmobile:postinstall] native binary missing, running prebuild-install…");
26
27
 
27
- // Try prebuild-install (downloads prebuilt binary from GitHub releases)
28
28
  try {
29
29
  execSync("npx prebuild-install -r napi --verbose", {
30
30
  cwd: ndcDir,
@@ -32,21 +32,13 @@ try {
32
32
  timeout: 120_000,
33
33
  });
34
34
  } catch {
35
- console.error(
36
- "[botmobile] prebuild-install failed. The native binary for node-datachannel could not be downloaded."
37
- );
38
- console.error(
39
- "[botmobile] To build from source, install build tools and run:"
40
- );
41
- console.error(` apt-get install -y build-essential cmake`);
42
- console.error(` cd ${ndcDir} && npx cmake-js compile -r napi`);
35
+ console.error("[botmobile:postinstall] prebuild-install failed");
43
36
  process.exit(1);
44
37
  }
45
38
 
46
- // Verify the binary was actually created
47
39
  if (!existsSync(binaryPath)) {
48
- console.error("[botmobile] prebuild-install completed but binary still missing at:", binaryPath);
40
+ console.error("[botmobile:postinstall] prebuild-install ran but binary still missing at:", binaryPath);
49
41
  process.exit(1);
50
42
  }
51
43
 
52
- console.log("[botmobile] node-datachannel native binary installed successfully");
44
+ console.log("[botmobile:postinstall] native binary installed successfully");