18 lines
492 B
Bash
18 lines
492 B
Bash
|
|
#!/usr/bin/env bash
|
|||
|
|
# 经本机 HTTP 代理安装 npm 与 Playwright Chromium(默认 http://localhost:7890)
|
|||
|
|
set -euo pipefail
|
|||
|
|
|
|||
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|||
|
|
PROXY_URL="${HTTP_PROXY:-${HTTPS_PROXY:-http://localhost:7890}}"
|
|||
|
|
|
|||
|
|
export HTTP_PROXY="$PROXY_URL"
|
|||
|
|
export HTTPS_PROXY="$PROXY_URL"
|
|||
|
|
export ALL_PROXY="${ALL_PROXY:-$PROXY_URL}"
|
|||
|
|
export NO_PROXY="${NO_PROXY:-127.0.0.1,localhost}"
|
|||
|
|
|
|||
|
|
echo "Using proxy: $HTTP_PROXY"
|
|||
|
|
|
|||
|
|
cd "$ROOT"
|
|||
|
|
npm ci
|
|||
|
|
npx playwright install chromium --with-deps
|