Skip to content

Commit

Permalink
Support .npmrc scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
voliva committed Jul 15, 2019
1 parent 4775da3 commit 51fadda
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions npm-diff
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ fi
module=$1
a=$2
b=$3
aurl=$(npm show $module@$a dist.tarball 2>/dev/null)
burl=$(npm show $module@$b dist.tarball 2>/dev/null)

# work dir

Expand All @@ -31,6 +33,7 @@ cd $work

download(){
version=$1
url=$2
mkdir $version
cd $version

Expand All @@ -39,16 +42,15 @@ download(){
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 $user $url | tar -xz --strip 1
if [[ ${PIPESTATUS[0]} != 0 ]]; then
echo "Unknown version: $module@$1"
exit 1
fi
}

download $a &
download $b &
download $a $aurl &
download $b $burl &

for job in `jobs -p`; do wait $job || exit 1; done

Expand Down

0 comments on commit 51fadda

Please sign in to comment.