Skip to content

Commit 1b30f31

Browse files
committed
build(scripts): 支持corepack安装校验,优雅下载
1 parent 3976247 commit 1b30f31

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

scripts/ci

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
#!/bin/bash
2+
##
3+
## 依赖安装脚本
4+
## 使用:
5+
## ./scripts/ci
6+
##
27

3-
#
4-
# 依赖安装脚本
5-
# 使用:
6-
# ./scripts/ci
7-
#
8-
9-
NPM_REGISTRY="https://mirrors.tencent.com/npm/"
8+
#NPM_REGISTRY="https://mirrors.tencent.com/npm/"
9+
NPM_REGISTRY="https://registry.npmmirror.com"
1010

1111
## 获取所有参数
1212
echo "运行命令: export COREPACK_NPM_REGISTRY=$NPM_REGISTRY && corepack enable pnpm && pnpm i --registry $NPM_REGISTRY --frozen-lockfile $*"
1313

14+
15+
# 检查是否已安装 corepack,如果没有则安装
16+
if ! command -v corepack &> /dev/null; then
17+
echo "未检测到 corepack,正在安装..."
18+
npm i corepack@latest -g
19+
else
20+
echo "corepack 已安装,版本: $(corepack --version)"
21+
fi
22+
1423
# 导出corepack环境变量,安装pnpm版本
15-
export COREPACK_NPM_REGISTRY=$NPM_REGISTRY COREPACK_INTEGRITY_KEYS=0 && corepack enable pnpm
24+
export COREPACK_NPM_REGISTRY=$NPM_REGISTRY && corepack enable pnpm
1625

17-
# 安装项目依赖
26+
# 安装项目依赖 -w -F @142vip/fairy-cli
1827
pnpm i --registry $NPM_REGISTRY --frozen-lockfile "$@"

0 commit comments

Comments
 (0)