feat(web): checkpoint web app init

- frontend (Vite/React) + server (Hono/Drizzle) scaffold under web/
- eeschema WASM embind kicadOpenFile hook + programmatic open-flow
- skip KiCad first-run setup wizard by seeding default config in preRun
- dev: auto-sync output/ WASM artifacts into tests/apps/kicad via link-wasm

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Gergő Törcsvári 2026-06-01 16:30:29 +02:00
commit 735e5aa8e9
No known key found for this signature in database
GPG key ID: 8E75F2CDE64E5322
70 changed files with 7775 additions and 13 deletions

View file

@ -15,6 +15,21 @@ OUTPUT_DIR="$PROJECT_ROOT/output"
mkdir -p "$KICAD_TEST"
# Smart copy: skip when the destination already exists and is byte-identical to
# the source (cmp -s is portable across macOS/Linux). Makes this a real sync —
# re-running does not rewrite unchanged multi-hundred-MB .wasm files.
smart_cp() {
local src="$1" destdir="$2"
[ -f "$src" ] || return 0
local dst="$destdir/$(basename "$src")"
if [ -f "$dst" ] && cmp -s "$src" "$dst"; then
echo " = $(basename "$src") (up-to-date)"
return 0
fi
cp "$src" "$dst"
echo " + $(basename "$src")"
}
# Map an app name to its inner CMake build subdirectory. Most apps share their
# subdir name with the app name; pcb_calculator emits OUTPUT_NAME=calculator
# but lives under the pcb_calculator/ subtree of the build dir, and pl_editor's
@ -36,12 +51,12 @@ copy_app() {
subdir=$(kicad_subdir_for "$app")
if [ -f "$OUTPUT_DIR/${app}.js" ] && [ -f "$OUTPUT_DIR/${app}.wasm" ]; then
echo "Copying ${app} WASM files from output directory..."
cp "$OUTPUT_DIR/${app}.js" "$KICAD_TEST/"
cp "$OUTPUT_DIR/${app}.wasm" "$KICAD_TEST/"
cp "$OUTPUT_DIR/${app}.wasm.map" "$KICAD_TEST/" 2>/dev/null || true
cp "$OUTPUT_DIR/${app}.worker.js" "$KICAD_TEST/" 2>/dev/null || true
cp "$OUTPUT_DIR/images.tar.gz" "$KICAD_TEST/" 2>/dev/null || true
echo "Syncing ${app} WASM files from output directory..."
smart_cp "$OUTPUT_DIR/${app}.js" "$KICAD_TEST"
smart_cp "$OUTPUT_DIR/${app}.wasm" "$KICAD_TEST"
smart_cp "$OUTPUT_DIR/${app}.wasm.map" "$KICAD_TEST"
smart_cp "$OUTPUT_DIR/${app}.worker.js" "$KICAD_TEST"
smart_cp "$OUTPUT_DIR/images.tar.gz" "$KICAD_TEST"
return 0
fi
@ -76,17 +91,17 @@ if [ "$found_any" -eq 0 ]; then
fi
# wxWidgets WASM JavaScript glue code (defines JS functions called from WASM)
echo "Copying wxWidgets WASM glue code..."
echo "Syncing wxWidgets WASM glue code..."
if [ -f "$OUTPUT_DIR/wx.js" ]; then
cp "$OUTPUT_DIR/wx.js" "$KICAD_TEST/"
smart_cp "$OUTPUT_DIR/wx.js" "$KICAD_TEST"
else
if docker compose -f "$PROJECT_ROOT/docker/docker-compose.yml" cp \
kicad-wasm-builder:/workspace/build-wasm/wxwidgets/build/wasm/wx.js "$KICAD_TEST/" 2>/dev/null; then
:
else
cp "$PROJECT_ROOT/wxwidgets/build/wasm/wx.js" "$KICAD_TEST/"
smart_cp "$PROJECT_ROOT/wxwidgets/build/wasm/wx.js" "$KICAD_TEST"
fi
fi
echo "KiCad WASM files copied to $KICAD_TEST"
echo "KiCad WASM files synced to $KICAD_TEST"
ls -lh "$KICAD_TEST"