Files
spark/scripts/compile-all.sh

72 lines
2.1 KiB
Bash
Raw Normal View History

feat(migration): Migrate from Node.js to Deno runtime Major migration to Deno runtime following the nupst project pattern: Core Changes: - Created deno.json configuration with tasks, imports, and settings - Created mod.ts as main entry point with Deno permissions - Updated all TypeScript imports from .js to .ts extensions - Replaced Node.js APIs (process.exit) with Deno equivalents (Deno.exit) - Updated path imports to use @std/path from JSR Dependencies: - Migrated all npm dependencies to use npm: prefix in import map - Added Deno standard library imports (@std/path, @std/assert) - Configured import aliases for all @push.rocks and @serve.zone packages Build & Distribution: - Created install.sh for downloading pre-compiled binaries - Created uninstall.sh for clean system removal - Created scripts/compile-all.sh for multi-platform compilation - Supports Linux (x64, ARM64), macOS (x64, ARM64), Windows (x64) Testing: - Migrated tests to Deno test framework using @std/assert - Created test.simple.ts for basic verification - Updated test structure to use Deno.test instead of tap CI/CD: - Created .gitea/workflows/ci.yml for type checking, linting, and builds - Created .gitea/workflows/release.yml for automated releases - Created .gitea/release-template.md for release documentation Cleanup: - Removed package.json, pnpm-lock.yaml, tsconfig.json - Removed Node.js CLI files (cli.js, cli.child.ts, cli.ts.js) - Removed dist_ts/ compiled output directory - Removed npmextra.json configuration This migration enables standalone binary distribution without Node.js runtime dependency while maintaining all existing functionality.
2025-10-23 23:22:16 +00:00
#!/bin/bash
set -e
# Get version from deno.json
VERSION=$(cat deno.json | grep -o '"version": *"[^"]*"' | cut -d'"' -f4)
BINARY_DIR="dist/binaries"
echo "================================================"
echo " SPARK Compilation Script"
echo " Version: ${VERSION}"
echo "================================================"
echo ""
echo "Compiling for all supported platforms..."
echo ""
# Clean up old binaries and create fresh directory
rm -rf "$BINARY_DIR"
mkdir -p "$BINARY_DIR"
echo "→ Cleaned old binaries from $BINARY_DIR"
echo ""
# Linux x86_64
echo "→ Compiling for Linux x86_64..."
deno compile --allow-all --no-check --output "$BINARY_DIR/spark-linux-x64" \
--target x86_64-unknown-linux-gnu mod.ts
echo " ✓ Linux x86_64 complete"
echo ""
# Linux ARM64
echo "→ Compiling for Linux ARM64..."
deno compile --allow-all --no-check --output "$BINARY_DIR/spark-linux-arm64" \
--target aarch64-unknown-linux-gnu mod.ts
echo " ✓ Linux ARM64 complete"
echo ""
# macOS x86_64
echo "→ Compiling for macOS x86_64..."
deno compile --allow-all --no-check --output "$BINARY_DIR/spark-macos-x64" \
--target x86_64-apple-darwin mod.ts
echo " ✓ macOS x86_64 complete"
echo ""
# macOS ARM64
echo "→ Compiling for macOS ARM64..."
deno compile --allow-all --no-check --output "$BINARY_DIR/spark-macos-arm64" \
--target aarch64-apple-darwin mod.ts
echo " ✓ macOS ARM64 complete"
echo ""
# Windows x86_64
echo "→ Compiling for Windows x86_64..."
deno compile --allow-all --no-check --output "$BINARY_DIR/spark-windows-x64.exe" \
--target x86_64-pc-windows-msvc mod.ts
echo " ✓ Windows x86_64 complete"
echo ""
echo "================================================"
echo " Compilation Summary"
echo "================================================"
echo ""
ls -lh "$BINARY_DIR/" | tail -n +2
echo ""
echo "✓ All binaries compiled successfully!"
echo ""
echo "Binary location: $BINARY_DIR/"
echo ""
echo "To create a release:"
echo " 1. Test the binaries on their respective platforms"
echo " 2. Create a git tag: git tag v${VERSION}"
echo " 3. Push the tag: git push origin v${VERSION}"
echo " 4. Upload the binaries to the release"
echo ""