-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·34 lines (28 loc) · 913 Bytes
/
Copy pathbuild.sh
File metadata and controls
executable file
·34 lines (28 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Build script for OpenCode Sidebar plugin
# Embeds Python PTY scripts as base64 into main.js
set -e
JS_FILE="main.js"
if [ ! -f "$JS_FILE" ]; then
echo "Error: $JS_FILE not found. Run 'npm run build' first."
exit 1
fi
# Embed Unix PTY script
if [ -f "terminal_pty.py" ]; then
echo "Embedding terminal_pty.py..."
B64=$(base64 -w 0 "terminal_pty.py" 2>/dev/null || base64 "terminal_pty.py" | tr -d '\n')
sed -i "s|__PTY_SCRIPT_B64__|$B64|g" "$JS_FILE"
echo "Done."
else
echo "Warning: terminal_pty.py not found"
fi
# Embed Windows PTY script
if [ -f "terminal_win.py" ]; then
echo "Embedding terminal_win.py..."
WIN_B64=$(base64 -w 0 "terminal_win.py" 2>/dev/null || base64 "terminal_win.py" | tr -d '\n')
sed -i "s|__WIN_PTY_SCRIPT_B64__|$WIN_B64|g" "$JS_FILE"
echo "Done."
else
echo "Warning: terminal_win.py not found"
fi
echo "Build complete!"