#!/bin/bash
# 1차 대시보드 그림 만들기 : 전체판 farm3d 장면을 정지 그림으로 → frontend/assets/v1/*
#   bash frontend/spec-src-v1/capture/build.sh   (playwright 는 /opt/pwtest)
S=$(cd "$(dirname "$0")" && pwd)
SRC=$S/../../spec-src
{ cat <<'H'
<!doctype html><html lang="ko"><head><meta charset="utf-8">
<script type="importmap">{ "imports": { "three": "https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js", "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/" } }</script>
<style>
H
  cat $S/../screens.css
  echo '</style></head><body><div class="scr" style="width:20px;height:20px"></div>'
  echo '<script type="module">'
  sed -e '1d' -e '$d' $SRC/farm3d.js
  echo "const V1_SENSORS = $(cat $S/sensors.json);"
  cat $S/cap_tail.js
  echo '</script></body></html>'
} > $S/capture.html
cd /opt/pwtest && node $S/capture.js "$S/capture.html" "$S/../../assets/v1"
