1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-06-28 19:16:16 +08:00
Files

41 lines
1.1 KiB
Bash
Executable File
Raw Permalink 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.
#!/bin/bash
#
# 依赖安装脚本
# 使用:
# ./scripts/ci
#
set -euo pipefail
NPM_REGISTRY="${NPM_REGISTRY:-https://registry.npmmirror.com}"
COREPACK_REGISTRY="${COREPACK_REGISTRY:-https://registry.npmjs.org}"
echo "运行命令: pnpm i --registry $NPM_REGISTRY --frozen-lockfile --force $*"
echo "COREPACK_REGISTRY: $COREPACK_REGISTRY"
if ! command -v corepack >/dev/null 2>&1; then
echo "未检测到 corepack正在安装..."
npm i -g corepack@latest --force
else
echo "corepack 已安装,版本: $(corepack --version)"
fi
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
export COREPACK_NPM_REGISTRY="$COREPACK_REGISTRY"
if pnpm --version >/dev/null 2>&1; then
echo "pnpm 已安装,版本: $(pnpm --version)"
else
echo "正在通过 corepack 启用 pnpm..."
corepack enable pnpm || true
if ! pnpm --version >/dev/null 2>&1; then
echo "corepack 版本过低,正在升级..."
npm i -g corepack@latest --force
corepack enable pnpm
fi
echo "pnpm 已安装,版本: $(pnpm --version)"
fi
pnpm i --registry "$NPM_REGISTRY" --frozen-lockfile --force "$@"