17 lines
913 B
Bash
Executable File
17 lines
913 B
Bash
Executable File
#!/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" "$@"
|