使用 pnpm 代替 yarn

This commit is contained in:
whyour 2021-05-16 23:09:20 +08:00
parent aa61fa7a45
commit e7355842d9
3 changed files with 8 additions and 6 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@
/yarn-error.log /yarn-error.log
/yarn.lock /yarn.lock
/package-lock.json /package-lock.json
/pnpm-lock.yaml
# production # production
/dist /dist

View File

@ -33,7 +33,8 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
&& chmod 777 ${QL_DIR}/shell/*.sh \ && chmod 777 ${QL_DIR}/shell/*.sh \
&& chmod 777 ${QL_DIR}/docker/*.sh \ && chmod 777 ${QL_DIR}/docker/*.sh \
&& npm install -g pm2 \ && npm install -g pm2 \
&& npm install -g pnpm \
&& rm -rf /root/.npm \ && rm -rf /root/.npm \
&& yarn install --production --network-timeout 100000 \ && pnpm install --prod \
&& yarn cache clean && rm -rf /root/.pnpm-store
ENTRYPOINT ["./docker/docker-entrypoint.sh"] ENTRYPOINT ["./docker/docker-entrypoint.sh"]

View File

@ -195,15 +195,15 @@ fix_config() {
fi fi
} }
## npm install 子程序,判断是否为安卓,判断是否安装有yarn ## npm install 子程序,判断是否为安卓,判断是否安装有pnpm
npm_install_sub() { npm_install_sub() {
if [ $is_termux -eq 1 ]; then if [ $is_termux -eq 1 ]; then
npm install --production --no-save --no-bin-links --registry=https://registry.npm.taobao.org || npm install --production --no-bin-links --no-save npm install --production --no-save --no-bin-links --registry=https://registry.npm.taobao.org || npm install --production --no-bin-links --no-save
elif ! type yarn >/dev/null 2>&1; then elif ! type pnpm >/dev/null 2>&1; then
npm install --production --no-save --registry=https://registry.npm.taobao.org || npm install --production --no-save npm install --production --no-save --registry=https://registry.npm.taobao.org || npm install --production --no-save
else else
echo -e "检测到本机安装了 yarn使用 yarn 替代 npm...\n" echo -e "检测到本机安装了 pnpm使用 pnpm 替代 ...\n"
yarn install --production --network-timeout 1000000000 --registry=https://registry.npm.taobao.org || yarn install --production --network-timeout 1000000000 pnpm install --prod --registry=https://registry.npm.taobao.org || pnpm install --prod
fi fi
} }