#!/bin/bash
# ./batch_bao.sh -u 用户名-p 密码 -r 本地仓库地址
# copy and run this script to the root of the repository directory containing files
# this script attempts to exclude uploading itself explicitly so the script name is important
# Get command line params
# https://www.jianshu.com/p/c04f1cc65a3d
# nrm use yapi_npm
# npm publish --registry http://10.33.6.49:8081/repository/yapi_npm/
# ./batch_bao.sh -u admin -p admin123 -r http://10.33.6.49:8081/repository/yapi_npm/ -m /home/lizhihua/yapi/vendors/node_modules -f package.json
REPO_URL='http://10.33.6.49:8081/repository/yapi_npm/'
USERNAME='admin'
PASSWORD='admin123'
MULU='.'
HASFILE='package.json'
echo
while getopts ":r:u:p:m:f:" opt; do
case $opt in
r) REPO_URL="$OPTARG"
;;
u) USERNAME="$OPTARG"
;;
p) PASSWORD="$OPTARG"
;;
m) MULU="$OPTARG"
;;
f) HASFILE="$OPTARG"
;;
esac
done
# 先注释了
# find . -type f -not -path './batch_bao\.sh*' -not -path '*/\.*' -not -path '*/\^archetype\-catalog\.xml*' -not -path '*/\^maven\-metadata\-local*\.xml' -not -path '*/\^maven\-metadata\-deployment*\.xml' | sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} ;
# echo curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{}
# 判断目录下是否存在 package.json
for file in "$MULU"/*;
do
if [ -d "$file" ];
then
# echo $file
#这里写上传代码 $file是目录名
if [ -f "$file/$HASFILE" ];then
echo "$file/$HASFILE"
cd "$file"
npm publish --registry "$REPO_URL"
fi;
fi;
done
#!/bin/bash
# ./batch_bao.sh -u 用户名-p 密码 -r 本地仓库地址 -m 目录 -f 检测文件
# copy and run this script to the root of the repository directory containing files
# this script attempts to exclude uploading itself explicitly so the script name is important
# Get command line params
# https://www.jianshu.com/p/c04f1cc65a3d
# nrm use yapi_npm
# npm publish --registry http://10.33.6.49:8081/repository/yapi_npm/
# ./batch_bao.sh -u admin -p admin123 -r http://10.33.6.49:8081/repository/yapi_npm/ -m /home/lizhihua/yapi/vendors/node_modules -f package.json
REPO_URL='http://10.33.6.49:8081/repository/yapi_npm/'
USERNAME='admin'
PASSWORD='admin123'
MULU='.'
HASFILE='package.json'
echo
while getopts ":r:u:p:m:f:" opt; do
case $opt in
r) REPO_URL="$OPTARG"
;;
u) USERNAME="$OPTARG"
;;
p) PASSWORD="$OPTARG"
;;
m) MULU="$OPTARG"
;;
f) HASFILE="$OPTARG"
;;
esac
done
# 先注释了
# find . -type f -not -path './batch_bao\.sh*' -not -path '*/\.*' -not -path '*/\^archetype\-catalog\.xml*' -not -path '*/\^maven\-metadata\-local*\.xml' -not -path '*/\^maven\-metadata\-deployment*\.xml' | sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} ;
# echo curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{}
# 判断目录下是否存在 package.json
for file in "$MULU"/*;
do
if [ -d "$file" ];
then
# echo $file
#这里写上传代码 $file是目录名
if [ -f "$file/$HASFILE" ];then
echo "$file/$HASFILE"
cd "$file"
npm publish --registry "$REPO_URL"
fi;
fi;
done
批量上传node包到nexus
猜你喜欢
转载自blog.csdn.net/lizhihua0625/article/details/123835147
今日推荐
周排行