@badgerclaw/connect 1.4.1 → 1.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@badgerclaw/connect",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "BadgerClaw channel plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -32,6 +32,6 @@
32
32
  }
33
33
  },
34
34
  "scripts": {
35
- "postinstall": "node scripts/postinstall.js"
35
+ "postinstall": "node scripts/postinstall.cjs"
36
36
  }
37
37
  }
@@ -1,16 +1,13 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * postinstall.js — patches openclaw package.json exports map to expose
4
- * plugin-sdk/compat subpath, which was removed in openclaw >=2026.3.24.
5
- * This runs automatically after `npm install` in the plugin directory.
6
- */
7
2
  const fs = require('fs');
8
3
  const path = require('path');
9
4
 
10
- const OPENCLAW_PKG = path.join(
11
- path.dirname(require.resolve('openclaw/package.json')),
12
- 'package.json'
13
- );
5
+ // Find openclaw package.json via common global install paths
6
+ const CANDIDATES = [
7
+ '/opt/homebrew/lib/node_modules/openclaw/package.json',
8
+ '/usr/local/lib/node_modules/openclaw/package.json',
9
+ path.join(process.env.HOME || '', '.npm-global/lib/node_modules/openclaw/package.json'),
10
+ ];
14
11
 
15
12
  const MISSING_EXPORTS = {
16
13
  './plugin-sdk/compat': {
@@ -23,8 +20,14 @@ const MISSING_EXPORTS = {
23
20
  },
24
21
  };
25
22
 
23
+ const pkgPath = CANDIDATES.find(p => fs.existsSync(p));
24
+ if (!pkgPath) {
25
+ console.log('[badgerclaw] postinstall: openclaw not found, skipping exports patch');
26
+ process.exit(0);
27
+ }
28
+
26
29
  try {
27
- const pkg = JSON.parse(fs.readFileSync(OPENCLAW_PKG, 'utf-8'));
30
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
28
31
  if (!pkg.exports) pkg.exports = {};
29
32
  let patched = false;
30
33
  for (const [key, entry] of Object.entries(MISSING_EXPORTS)) {
@@ -35,10 +38,10 @@ try {
35
38
  }
36
39
  }
37
40
  if (patched) {
38
- fs.writeFileSync(OPENCLAW_PKG, JSON.stringify(pkg, null, 2));
41
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
39
42
  } else {
40
43
  console.log('[badgerclaw] openclaw exports map already up to date');
41
44
  }
42
45
  } catch (e) {
43
- console.log('[badgerclaw] postinstall: could not patch openclaw exports map:', e.message);
46
+ console.log('[badgerclaw] postinstall warning:', e.message);
44
47
  }