openmux 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/bin/openmux +49 -5
  2. package/package.json +1 -1
package/bin/openmux CHANGED
@@ -4,8 +4,47 @@ set -euo pipefail
4
4
  # openmux npm bin wrapper
5
5
  # Locates and executes the downloaded binary
6
6
 
7
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
- PACKAGE_DIR="$(dirname "$SCRIPT_DIR")"
7
+ # Find the package directory - check multiple possible locations
8
+ find_package_dir() {
9
+ local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
+
11
+ # Check if we're in the package's bin directory (npm/yarn symlink)
12
+ if [[ -f "$(dirname "$script_dir")/package.json" ]]; then
13
+ echo "$(dirname "$script_dir")"
14
+ return
15
+ fi
16
+
17
+ # Bun global: ~/.bun/install/global/node_modules/openmux
18
+ if [[ -d "$HOME/.bun/install/global/node_modules/openmux" ]]; then
19
+ echo "$HOME/.bun/install/global/node_modules/openmux"
20
+ return
21
+ fi
22
+
23
+ # npm global (macOS/Linux)
24
+ local npm_prefix
25
+ npm_prefix="$(npm prefix -g 2>/dev/null || echo "")"
26
+ if [[ -n "$npm_prefix" && -d "$npm_prefix/lib/node_modules/openmux" ]]; then
27
+ echo "$npm_prefix/lib/node_modules/openmux"
28
+ return
29
+ fi
30
+
31
+ # Fallback: search common locations
32
+ local locations=(
33
+ "/usr/local/lib/node_modules/openmux"
34
+ "/usr/lib/node_modules/openmux"
35
+ "$HOME/.npm-global/lib/node_modules/openmux"
36
+ )
37
+ for loc in "${locations[@]}"; do
38
+ if [[ -d "$loc" ]]; then
39
+ echo "$loc"
40
+ return
41
+ fi
42
+ done
43
+
44
+ echo ""
45
+ }
46
+
47
+ PACKAGE_DIR="$(find_package_dir)"
9
48
  DIST_DIR="$PACKAGE_DIR/dist"
10
49
 
11
50
  # Determine library extension based on OS
@@ -16,9 +55,14 @@ case "$(uname -s)" in
16
55
  esac
17
56
 
18
57
  # Check if binary exists
19
- if [[ ! -x "$DIST_DIR/openmux-bin" ]]; then
20
- echo "Error: openmux binary not found at $DIST_DIR/openmux-bin" >&2
21
- echo "Run 'npm run build' or reinstall the package" >&2
58
+ if [[ -z "$PACKAGE_DIR" || ! -x "$DIST_DIR/openmux-bin" ]]; then
59
+ echo "Error: openmux binary not found" >&2
60
+ echo "Package dir: ${PACKAGE_DIR:-not found}" >&2
61
+ echo "Expected binary at: $DIST_DIR/openmux-bin" >&2
62
+ echo "" >&2
63
+ echo "Try reinstalling: npm install -g openmux" >&2
64
+ echo "Or run postinstall manually:" >&2
65
+ echo " node \"\$PACKAGE_DIR/scripts/postinstall.cjs\"" >&2
22
66
  exit 1
23
67
  fi
24
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmux",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Terminal multiplexer with master-stack tiling layout",
5
5
  "module": "src/index.tsx",
6
6
  "type": "module",