openmux 0.1.2 → 0.1.4
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/openmux +107 -11
- package/package.json +4 -2
package/bin/openmux
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
# openmux npm bin wrapper
|
|
5
|
-
#
|
|
5
|
+
# Downloads binary on first run if missing, then executes
|
|
6
|
+
|
|
7
|
+
REPO="monotykamary/openmux"
|
|
6
8
|
|
|
7
9
|
# Find the package directory - check multiple possible locations
|
|
8
10
|
find_package_dir() {
|
|
@@ -44,7 +46,108 @@ find_package_dir() {
|
|
|
44
46
|
echo ""
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
get_version() {
|
|
50
|
+
local pkg_json="$1/package.json"
|
|
51
|
+
if [[ -f "$pkg_json" ]]; then
|
|
52
|
+
grep '"version"' "$pkg_json" | head -1 | sed 's/.*"version": *"\([^"]*\)".*/\1/'
|
|
53
|
+
else
|
|
54
|
+
echo ""
|
|
55
|
+
fi
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get_platform() {
|
|
59
|
+
local os arch
|
|
60
|
+
os="$(uname -s)"
|
|
61
|
+
arch="$(uname -m)"
|
|
62
|
+
|
|
63
|
+
case "$os" in
|
|
64
|
+
Darwin) os="darwin" ;;
|
|
65
|
+
Linux) os="linux" ;;
|
|
66
|
+
*) echo ""; return ;;
|
|
67
|
+
esac
|
|
68
|
+
|
|
69
|
+
case "$arch" in
|
|
70
|
+
x86_64|amd64) arch="x64" ;;
|
|
71
|
+
arm64|aarch64) arch="arm64" ;;
|
|
72
|
+
*) echo ""; return ;;
|
|
73
|
+
esac
|
|
74
|
+
|
|
75
|
+
echo "${os}-${arch}"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
spinner() {
|
|
79
|
+
local pid=$1
|
|
80
|
+
local spin='⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'
|
|
81
|
+
local i=0
|
|
82
|
+
while kill -0 "$pid" 2>/dev/null; do
|
|
83
|
+
printf "\r %s %s" "${spin:i++%${#spin}:1}" "$2"
|
|
84
|
+
sleep 0.1
|
|
85
|
+
done
|
|
86
|
+
printf "\r"
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
download_binary() {
|
|
90
|
+
local package_dir="$1"
|
|
91
|
+
local dist_dir="$package_dir/dist"
|
|
92
|
+
local version="v$(get_version "$package_dir")"
|
|
93
|
+
local platform="$(get_platform)"
|
|
94
|
+
|
|
95
|
+
if [[ -z "$version" || "$version" == "v" ]]; then
|
|
96
|
+
echo "Error: Could not determine openmux version" >&2
|
|
97
|
+
return 1
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
if [[ -z "$platform" ]]; then
|
|
101
|
+
echo "Error: Unsupported platform" >&2
|
|
102
|
+
return 1
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
local url="https://github.com/$REPO/releases/download/$version/openmux-$version-$platform.tar.gz"
|
|
106
|
+
|
|
107
|
+
printf "\n"
|
|
108
|
+
printf " \033[1mopenmux\033[0m %s\n" "$version"
|
|
109
|
+
printf " Setting up for first run...\n"
|
|
110
|
+
printf "\n"
|
|
111
|
+
|
|
112
|
+
mkdir -p "$dist_dir"
|
|
113
|
+
local tmp_file="$dist_dir/download.tar.gz"
|
|
114
|
+
|
|
115
|
+
# Download with spinner
|
|
116
|
+
if command -v curl &>/dev/null; then
|
|
117
|
+
curl -fsSL "$url" -o "$tmp_file" 2>/dev/null &
|
|
118
|
+
elif command -v wget &>/dev/null; then
|
|
119
|
+
wget -q "$url" -O "$tmp_file" 2>/dev/null &
|
|
120
|
+
else
|
|
121
|
+
echo "Error: curl or wget required" >&2
|
|
122
|
+
return 1
|
|
123
|
+
fi
|
|
124
|
+
spinner $! "Downloading..."
|
|
125
|
+
wait $! || { printf " \033[31mDownload failed\033[0m\n"; return 1; }
|
|
126
|
+
printf " \033[32m✓\033[0m Downloaded\n"
|
|
127
|
+
|
|
128
|
+
# Extract with spinner
|
|
129
|
+
tar -xzf "$tmp_file" -C "$dist_dir" &
|
|
130
|
+
spinner $! "Extracting..."
|
|
131
|
+
wait $!
|
|
132
|
+
rm -f "$tmp_file"
|
|
133
|
+
printf " \033[32m✓\033[0m Extracted\n"
|
|
134
|
+
|
|
135
|
+
# Make executable
|
|
136
|
+
chmod +x "$dist_dir/openmux-bin" 2>/dev/null || true
|
|
137
|
+
chmod +x "$dist_dir/openmux" 2>/dev/null || true
|
|
138
|
+
|
|
139
|
+
printf "\n"
|
|
140
|
+
printf " \033[32mReady!\033[0m Starting openmux...\n"
|
|
141
|
+
printf "\n"
|
|
142
|
+
}
|
|
143
|
+
|
|
47
144
|
PACKAGE_DIR="$(find_package_dir)"
|
|
145
|
+
|
|
146
|
+
if [[ -z "$PACKAGE_DIR" ]]; then
|
|
147
|
+
echo "Error: Could not find openmux package directory" >&2
|
|
148
|
+
exit 1
|
|
149
|
+
fi
|
|
150
|
+
|
|
48
151
|
DIST_DIR="$PACKAGE_DIR/dist"
|
|
49
152
|
|
|
50
153
|
# Determine library extension based on OS
|
|
@@ -54,16 +157,9 @@ case "$(uname -s)" in
|
|
|
54
157
|
*) echo "Unsupported OS" >&2; exit 1 ;;
|
|
55
158
|
esac
|
|
56
159
|
|
|
57
|
-
#
|
|
58
|
-
if [[
|
|
59
|
-
|
|
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
|
|
66
|
-
exit 1
|
|
160
|
+
# Download binary if missing
|
|
161
|
+
if [[ ! -x "$DIST_DIR/openmux-bin" ]]; then
|
|
162
|
+
download_binary "$PACKAGE_DIR" || exit 1
|
|
67
163
|
fi
|
|
68
164
|
|
|
69
165
|
# Set library path and execute
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openmux",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Terminal multiplexer with master-stack tiling layout",
|
|
5
5
|
"module": "src/index.tsx",
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"bin",
|
|
12
|
-
"scripts/postinstall.cjs"
|
|
12
|
+
"scripts/postinstall.cjs",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
13
15
|
],
|
|
14
16
|
"scripts": {
|
|
15
17
|
"start": "bun run src/index.tsx",
|