npm 依赖上传Nexus教程
1.准备好依赖,要求是tgz


2.在traversePublishScript.sh脚本当前目录执行脚本
脚本中的ip、端口、仓库名、账号、密码要改成真实的

traversePublishScript.sh
#!/bin/bash #第三步创建的tgz文件路径 targetDir=D:/MyData/应用部署配置/前端部署/test publishRestful=http://10.10.1.56:8081/service/rest/v1/components?repository=npm-hosted echo ">>> 文件所在目录:$targetDir <<<" function traverse() { for file in "$1"/* do if [ -d "$file" ] ; then traverse "$file" else # 在这里执行您想要对每个文件执行的操作 echo ">>> $targetDir/$file 上传开始 \n" ret=`curl -u admin:It091872@ -X POST "$publishRestful" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "npm.asset=@$file;type=application/x-compressed"` echo $ret echo ">>> $targetDir/$file 上传完成 \n" echo "$file" fi done } traverse $targetDir
本文来自博客园,作者:咔咔皮卡丘,转载请注明原文链接:https://www.cnblogs.com/anquing/p/19033236

浙公网安备 33010602011771号