Skip to content

Instantly share code, notes, and snippets.

@kcowgill
Created August 3, 2017 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kcowgill/23c4337e86b10b5f333081bbc636218e to your computer and use it in GitHub Desktop.
Save kcowgill/23c4337e86b10b5f333081bbc636218e to your computer and use it in GitHub Desktop.
#!/bin/bash
for FILE in `ls *.tgz`; do
echo "Unzipping '$FILE'"
tar xzf $FILE
cd package/
echo "Checking for old repo..."
perl -pi -e 's/https.*/http:\/\/new.repository\/repository\/custom-npm\/"/ if m/registry.*https:\/\/package/' package.json
echo "Uploading to new repo..."
npm publish --registry=http://new.repository/repository/custom-npm/
cd ..
rm -rf package
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment