Add capture-proof for sharp Playwright proof screenshots

This commit is contained in:
Gabriel Brown
2026-09-22 15:18:38 -04:00
parent 88032490c0
commit de3591a25b
2 changed files with 144 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Screenshots a running app for a ticket's proof with Playwright. See: capture-proof help
# The first run installs a pinned Playwright and its Chromium into ~/.cache/ticket-page.
set -euo pipefail
version=1.60.0
here="$(dirname "$(readlink -f "$0")")"
pw="${XDG_CACHE_HOME:-$HOME/.cache}/ticket-page/playwright"
command -v node >/dev/null 2>&1 || { echo "capture-proof: node is not on PATH" >&2; exit 127; }
if [[ "$(node -p "try{require('$pw/node_modules/playwright/package.json').version}catch{''}" 2>/dev/null)" != "$version" ]]; then
echo "capture-proof: installing Playwright $version into $pw" >&2
mkdir -p "$pw"
[[ -f "$pw/package.json" ]] || echo '{"private":true}' > "$pw/package.json"
(cd "$pw" && npm install --silent --no-audit --no-fund "playwright@$version") >&2
node "$pw/node_modules/playwright/cli.js" install chromium >&2
fi
exec node "$here/capture-proof.ts" "$@"