-
-
Save Keroosha/0cc961a90e3d67bc4e303f0136ef75d9 to your computer and use it in GitHub Desktop.
Easy to use dev env packages uploader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function install_shrinkpack() { npm i -g shrinkpack || exit 1; } | |
[ -z "$NEXUS_USER" ] && echo "Missing NEXUS_USER" && exit 1 | |
[ -z "$NEXUS_PASSWORD" ] && echo "Missing NEXUS_PASSWORD" && exit 1 | |
[ -z "$NEXUS_REPO" ] && echo "Missing NEXUS_REPO" && exit 1 | |
[ -z "$NEXUS_URL" ] && echo "Missing NEXUS_URL" && exit 1 | |
[ -z "$(which shrinkpack)" ] && install_shrinkpack | |
cp package-lock.json package-lock.json.old | |
shrinkpack | |
for F in node_shrinkpack/* | |
do | |
echo "sending $F" | |
gzip -S .tgz "$F" | |
curl -u "$NEXUS_USER:$NEXUS_PASSWORD" -v \ | |
-F "npm.asset=@$(pwd)/$F.tgz" "$NEXUS_URL/service/rest/v1/components?repository=$NEXUS_REPO" \ | |
|| exit 1 | |
done | |
rm -rf node_shrinkpack | |
mv package-lock.json.old package-lock.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment