From 3c327216a4502755a39e93431b47619aa2f2ca03 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Mon, 12 Jan 2026 02:15:16 -0800 Subject: [PATCH] Make local build script work across more platforms (#1681) * Enhance local build script and frontend package configuration - Updated `local-build.sh` to detect OS and architecture, setting the target directory dynamically based on the platform. - Modified build and lint scripts in `frontend/package.json` to include `NODE_OPTIONS=--max-old-space-size=4096` for improved memory management during builds and linting. * Enhance local build script and frontend package configuration - Updated `local-build.sh` to detect OS and architecture, setting the target directory dynamically based on the platform. - Modified build and lint scripts in `frontend/package.json` to include `NODE_OPTIONS=--max-old-space-size=4096` for improved memory management during builds and linting. --- local-build.sh | 59 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/local-build.sh b/local-build.sh index 73dcaf8e..288e14b2 100755 --- a/local-build.sh +++ b/local-build.sh @@ -2,9 +2,48 @@ 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" echo "๐Ÿงน Cleaning previous builds..." rm -rf npx-cli/dist -mkdir -p npx-cli/dist/macos-arm64 +mkdir -p npx-cli/dist/$PLATFORM echo "๐Ÿ”จ Building frontend..." (cd frontend && npm run build) @@ -16,28 +55,28 @@ cargo build --release --bin mcp_task_server --manifest-path Cargo.toml echo "๐Ÿ“ฆ Creating distribution package..." # Copy the main binary -cp target/release/server vibe-kanban +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/macos-arm64/vibe-kanban.zip +mv vibe-kanban.zip npx-cli/dist/$PLATFORM/vibe-kanban.zip # Copy the MCP binary -cp target/release/mcp_task_server vibe-kanban-mcp +cp ${CARGO_TARGET_DIR}/release/mcp_task_server 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/macos-arm64/vibe-kanban-mcp.zip +mv vibe-kanban-mcp.zip npx-cli/dist/$PLATFORM/vibe-kanban-mcp.zip # Copy the Review CLI binary -cp target/release/review vibe-kanban-review +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/macos-arm64/vibe-kanban-review.zip +mv vibe-kanban-review.zip npx-cli/dist/$PLATFORM/vibe-kanban-review.zip echo "โœ… Build complete!" echo "๐Ÿ“ Files created:" -echo " - npx-cli/dist/macos-arm64/vibe-kanban.zip" -echo " - npx-cli/dist/macos-arm64/vibe-kanban-mcp.zip" -echo " - npx-cli/dist/macos-arm64/vibe-kanban-review.zip" +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" echo "" echo "๐Ÿš€ To test locally, run:" echo " cd npx-cli && node bin/cli.js"