chore: migrate setup.sh bootstrap to pnpm

Replace npm ci with corepack enable + pnpm install --frozen-lockfile.
Remove --unsafe-perm logic (not needed with pnpm).
This commit is contained in:
meeech
2026-04-14 00:29:35 -04:00
committed by gavrielc
parent 0b06343323
commit 2b7fef628d

View File

@@ -2,7 +2,7 @@
set -euo pipefail set -euo pipefail
# setup.sh — Bootstrap script for NanoClaw # setup.sh — Bootstrap script for NanoClaw
# Handles Node.js/npm setup, then hands off to the Node.js setup modules. # Handles Node.js/pnpm setup, then hands off to the Node.js setup modules.
# This is the only bash script in the setup flow. # This is the only bash script in the setup flow.
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -59,32 +59,29 @@ check_node() {
fi fi
} }
# --- npm install --- # --- pnpm install ---
install_deps() { install_deps() {
DEPS_OK="false" DEPS_OK="false"
NATIVE_OK="false" NATIVE_OK="false"
if [ "$NODE_OK" = "false" ]; then if [ "$NODE_OK" = "false" ]; then
log "Skipping npm install — Node not available" log "Skipping pnpm install — Node not available"
return return
fi fi
cd "$PROJECT_ROOT" cd "$PROJECT_ROOT"
# npm install with --unsafe-perm if root (needed for native modules) # Enable corepack for pnpm
local npm_flags="" log "Enabling corepack"
if [ "$IS_ROOT" = "true" ]; then corepack enable >> "$LOG_FILE" 2>&1 || true
npm_flags="--unsafe-perm"
log "Running as root, using --unsafe-perm"
fi
log "Running npm ci $npm_flags" log "Running pnpm install --frozen-lockfile"
if npm ci $npm_flags >> "$LOG_FILE" 2>&1; then if pnpm install --frozen-lockfile >> "$LOG_FILE" 2>&1; then
DEPS_OK="true" DEPS_OK="true"
log "npm install succeeded" log "pnpm install succeeded"
else else
log "npm install failed" log "pnpm install failed"
return return
fi fi