-
Notifications
You must be signed in to change notification settings - Fork 3k
Expand file tree
/
Copy pathlocal-build.sh
More file actions
executable file
·145 lines (118 loc) · 4.08 KB
/
Copy pathlocal-build.sh
File metadata and controls
executable file
·145 lines (118 loc) · 4.08 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
set -e # Exit on any error
# Detect OS and architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
# Map architecture names
case "$ARCH" in
x86_64)
ARCH="x64"
;;
arm64|aarch64)
ARCH="arm64"
;;
*)
echo "⚠️ Warning: Unknown architecture $ARCH, using as-is"
;;
esac
# Map OS names
case "$OS" in
linux)
OS="linux"
;;
darwin)
OS="macos"
;;
*)
echo "⚠️ Warning: Unknown OS $OS, using as-is"
;;
esac
PLATFORM="${OS}-${ARCH}"
# Set CARGO_TARGET_DIR if not defined
if [ -z "$CARGO_TARGET_DIR" ]; then
CARGO_TARGET_DIR="target"
fi
echo "🔍 Detected platform: $PLATFORM"
echo "🔧 Using target directory: $CARGO_TARGET_DIR"
# Set API base URL for remote features
export VK_SHARED_API_BASE="https://api.vibekanban.com"
export VITE_VK_SHARED_API_BASE="https://api.vibekanban.com"
echo "🧹 Cleaning previous builds..."
rm -rf npx-cli/dist
mkdir -p npx-cli/dist/$PLATFORM
echo "🔨 Building web app..."
(cd packages/local-web && npm run build)
echo "🔨 Building Rust binaries..."
cargo build --release --manifest-path Cargo.toml
cargo build --release --bin vibe-kanban-mcp --manifest-path Cargo.toml
echo "📦 Creating distribution package..."
# Copy the main binary
cp ${CARGO_TARGET_DIR}/release/server vibe-kanban
zip -q vibe-kanban.zip vibe-kanban
rm -f vibe-kanban
mv vibe-kanban.zip npx-cli/dist/$PLATFORM/vibe-kanban.zip
# Copy the MCP binary
cp ${CARGO_TARGET_DIR}/release/vibe-kanban-mcp vibe-kanban-mcp
zip -q vibe-kanban-mcp.zip vibe-kanban-mcp
rm -f vibe-kanban-mcp
mv vibe-kanban-mcp.zip npx-cli/dist/$PLATFORM/vibe-kanban-mcp.zip
# Copy the Review CLI binary
cp ${CARGO_TARGET_DIR}/release/review vibe-kanban-review
zip -q vibe-kanban-review.zip vibe-kanban-review
rm -f vibe-kanban-review
mv vibe-kanban-review.zip npx-cli/dist/$PLATFORM/vibe-kanban-review.zip
echo "✅ CLI build complete!"
echo "📁 Files created:"
echo " - npx-cli/dist/$PLATFORM/vibe-kanban.zip"
echo " - npx-cli/dist/$PLATFORM/vibe-kanban-mcp.zip"
echo " - npx-cli/dist/$PLATFORM/vibe-kanban-review.zip"
# Optionally build the Tauri desktop app
if [[ "$1" == "--desktop" || "$1" == "--all" ]]; then
# Map to Tauri platform naming
case "$OS" in
macos) TAURI_OS="darwin" ;;
linux) TAURI_OS="linux" ;;
*) TAURI_OS="$OS" ;;
esac
case "$ARCH" in
arm64) TAURI_ARCH="aarch64" ;;
x64) TAURI_ARCH="x86_64" ;;
*) TAURI_ARCH="$ARCH" ;;
esac
TAURI_PLATFORM="${TAURI_OS}-${TAURI_ARCH}"
echo ""
echo "🖥️ Building Tauri desktop app for $TAURI_PLATFORM..."
# Replace the updater endpoint placeholder with a dummy URL for local builds
# (CI injects the real R2 URL; locally the updater is non-functional)
TAURI_CONF="crates/tauri-app/tauri.conf.json"
node -e "
const fs = require('fs');
const conf = JSON.parse(fs.readFileSync('$TAURI_CONF', 'utf8'));
conf.plugins.updater.endpoints = conf.plugins.updater.endpoints.map(e =>
e === '__TAURI_UPDATE_ENDPOINT__' ? 'https://localhost/disabled' : e
);
fs.writeFileSync('$TAURI_CONF', JSON.stringify(conf, null, 2) + '\n');
"
cargo tauri build
# Restore tauri.conf.json
git checkout -- "$TAURI_CONF"
TAURI_DIST="npx-cli/dist/tauri/$TAURI_PLATFORM"
mkdir -p "$TAURI_DIST"
BUNDLE_DIR="${CARGO_TARGET_DIR}/release/bundle"
# Copy updater artifacts (tar.gz bundles or NSIS exe)
find "$BUNDLE_DIR" -name "*.app.tar.gz" ! -name "*.sig" -exec cp {} "$TAURI_DIST/" \; 2>/dev/null || true
find "$BUNDLE_DIR" -name "*.AppImage.tar.gz" ! -name "*.sig" -exec cp {} "$TAURI_DIST/" \; 2>/dev/null || true
find "$BUNDLE_DIR" -name "*-setup.exe" -exec cp {} "$TAURI_DIST/" \; 2>/dev/null || true
echo "✅ Desktop app built:"
ls -la "$TAURI_DIST/"
fi
echo ""
echo "📦 Installing npx-cli dependencies..."
(cd npx-cli && npm ci)
echo ""
echo "🔨 Building npx-cli TypeScript..."
(cd npx-cli && npm run build)
echo ""
echo "🚀 To test locally, run:"
echo " cd npx-cli && node bin/cli.js # browser mode (default)"
echo " cd npx-cli && node bin/cli.js --desktop # desktop mode (requires --desktop or --all build flag)"