test-package.shโข1.66 kB
#!/bin/bash
# Simple package test script for Peekaboo MCP
# Tests the package locally without publishing
set -e
echo "๐งช Testing npm package locally..."
echo ""
# Build everything
echo "๐จ Building package..."
npm run build:swift:all
# Create package
echo "๐ฆ Creating package tarball..."
PACKAGE_FILE=$(npm pack | tail -n 1)
PACKAGE_PATH=$(pwd)/$PACKAGE_FILE
echo "Created: $PACKAGE_FILE"
# Get package info
PACKAGE_SIZE=$(du -h "$PACKAGE_FILE" | cut -f1)
echo "Package size: $PACKAGE_SIZE"
# Test installation in a temporary directory
TEMP_DIR=$(mktemp -d)
echo ""
echo "๐ฅ Testing installation in: $TEMP_DIR"
cd "$TEMP_DIR"
# Initialize a test project
npm init -y > /dev/null 2>&1
# Install the package from tarball
echo "๐ฆ Installing from tarball..."
npm install "$PACKAGE_PATH"
# Check installation
echo ""
echo "๐ Checking installation..."
# Check if binary exists and is executable
if [ -f "node_modules/peekaboo/peekaboo" ]; then
echo "โ
Binary found"
# Check if executable
if [ -x "node_modules/peekaboo/peekaboo" ]; then
echo "โ
Binary is executable"
# Test the binary
echo ""
echo "๐งช Testing Swift CLI..."
if node_modules/peekaboo/peekaboo --version; then
echo "โ
Swift CLI works!"
else
echo "โ Swift CLI failed"
fi
else
echo "โ Binary is not executable"
fi
else
echo "โ Binary not found!"
fi
# Cleanup
cd - > /dev/null
rm -rf "$TEMP_DIR"
rm -f "$PACKAGE_PATH"
echo ""
echo "โจ Package test complete!"
echo ""
echo "If all tests passed, the package is ready for publishing!"