cloudflare/kumo
Publicmirrored fromhttps://github.com/cloudflare/kumoAvailable
packages/kumo-figma/src/build.sh
38lines · modecode
| 1 | #!/bin/bash |
| 2 | # Build script for Kumo Figma Plugin |
| 3 | # |
| 4 | # Figma's plugin runtime uses an older JavaScript engine that doesn't support: |
| 5 | # - Nullish coalescing (??) |
| 6 | # - Optional chaining (?.) |
| 7 | # - Some ES2020+ features |
| 8 | # |
| 9 | # We target ES2017 to ensure compatibility. |
| 10 | |
| 11 | set -e |
| 12 | |
| 13 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 14 | FIGMA_PKG_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" |
| 15 | |
| 16 | echo "Building Kumo Figma Plugin..." |
| 17 | |
| 18 | # Generate theme data from CSS source files (MUST run first) |
| 19 | echo "🎨 Generating theme data from CSS..." |
| 20 | cd "$SCRIPT_DIR" |
| 21 | npx tsx build-theme-data.ts |
| 22 | |
| 23 | # Generate icon and loader data from source files |
| 24 | echo "📖 Generating icon data..." |
| 25 | npx tsx build-icon-data.ts 2>/dev/null || echo "⚠️ Icon data generation skipped (may already exist)" |
| 26 | |
| 27 | echo "📖 Generating loader data..." |
| 28 | npx tsx build-loader-data.ts 2>/dev/null || echo "⚠️ Loader data generation skipped (may already exist)" |
| 29 | |
| 30 | cd "$FIGMA_PKG_DIR" |
| 31 | pnpm exec esbuild "$SCRIPT_DIR/code.ts" \ |
| 32 | --bundle \ |
| 33 | --outfile="$SCRIPT_DIR/code.js" \ |
| 34 | --format=iife \ |
| 35 | --target=es2017 \ |
| 36 | --log-level=info |
| 37 | |
| 38 | echo "✅ Build complete: $SCRIPT_DIR/code.js" |
| 39 | |