Permalink
Browse files

authenticate if always-auth is true

  • Loading branch information...
1 parent 10c36bf commit 2b955da3fc56b870d042ccd8c5677042694041df @juliangruber committed Feb 13, 2014
Showing with 7 additions and 1 deletion.
  1. +7 −1 npm-diff
View
8 npm-diff
@@ -32,8 +32,14 @@ download(){
version=$1
mkdir $version
cd $version
+
+ user=""
+ if [ "$(npm config get always-auth)" == "true" ]; then
+ user="--user $(cat ~/.npmrc | grep _auth | cut -d' ' -f3 | base64 --decode)"
+ fi
+
url=$(npm show $module@$version dist.tarball 2>/dev/null)
- curl --fail --silent --insecure $url | tar -xz --strip 1
+ curl --fail --silent --insecure $user $url | tar -xz --strip 1
if [[ ${PIPESTATUS[0]} != 0 ]]; then
echo "Unknown version: $module@$1"
exit 1

0 comments on commit 2b955da

Please sign in to comment.