pr-hw1/scripts/pnpm.sh
peppa-bot a248cddbaa
All checks were successful
peppa/lint lint: success за 0с
peppa/typecheck typecheck: success за 4с
peppa/test test: success за 1с
peppa/build build: success за 2с
ci / checks (pull_request) Successful in 24s
deploy / deploy (pull_request) Successful in 23s
PH-1: проверки запускают pnpm без предустановки (corepack, npx или Node 22 в кеш)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 10:05:15 +00:00

22 lines
1.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# Запуск pnpm в любом окружении проверок: свой pnpm → corepack (идёт с Node) → npx.
# Версия pnpm — из package.json → packageManager.
set -euo pipefail
cd "$(dirname "$0")/.."
if command -v pnpm >/dev/null 2>&1; then exec pnpm "$@"; fi
if ! command -v node >/dev/null 2>&1; then
# В образе проверок нет Node — ставим Node 22 в кеш пользователя (один раз).
dir="${XDG_CACHE_HOME:-$HOME/.cache}/peppa-node22"
if [[ ! -x "$dir/bin/node" ]]; then
arch=$(uname -m); case "$arch" in x86_64) arch=x64 ;; aarch64) arch=arm64 ;; esac
ver=$(curl -fsSL https://nodejs.org/dist/latest-v22.x/SHASUMS256.txt | grep -oE "node-v22[.0-9]+-linux-$arch.tar.gz" | head -1)
mkdir -p "$dir"
curl -fsSL "https://nodejs.org/dist/latest-v22.x/$ver" | tar -xz -C "$dir" --strip-components=1
fi
export PATH="$dir/bin:$PATH"
fi
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
if command -v corepack >/dev/null 2>&1; then exec corepack pnpm "$@"; fi
ver=$(node -p 'require("./package.json").packageManager.split("@")[1]')
exec npx --yes "pnpm@$ver" "$@"