-
-
Save nexdrew/9b198381a9eb2eca407e658be860edfe to your computer and use it in GitHub Desktop.
Revisions
-
nexdrew revised this gist
Nov 29, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -43,7 +43,7 @@ fi download(){ curl -H "Authorization: Bearer $NPMTOKEN" "$1" > tartmp.tgz 2> /dev/null if [ "$?" != "0" ]; then echo "failed to download tar $1" 2>1 exit $? -
soldair revised this gist
Nov 29, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,7 @@ fi echo "republishing all versions of $modulename to registry $registry" tars=`curl -H "Authorization: Bearer $NPMTOKEN" https://registry.npmjs.org/$modulename 2> /dev/null | \ node -e "s='';process.stdin.on('data',function(b){s += b}).on('end',function(){ process.stdout.write(JSON.stringify(JSON.parse(s),null,' ')+'\n')})" | \ grep tarball | sed 's/[",]//g' | awk '{print $2}'` @@ -43,7 +43,7 @@ fi download(){ curl -H "Authorization: Bearer $NPMTOKEN" "$1" > tartmp.tgz if [ "$?" != "0" ]; then echo "failed to download tar $1" 2>1 exit $? -
soldair revised this gist
Nov 29, 2016 . 1 changed file with 33 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,22 +10,40 @@ fi NPMTOKEN=`grep ^//registry.npmjs.org/:_authToken= ~/.npmrc | sed 's/_authToken=/ /' | awk '{print $2}'` reallyPublish="$3" registry="$2" modulename=`echo "$1" | sed 's/\//%2f/'` helptext="usage: ./republish.sh [module name] [target registry] [--really-publish] example: ./republish.sh lodash https://npme.mycompany.com # without the --really-publish this performs a dry run." if [ "$registry" == "" ]; then echo $helptext exit 1 fi if [ "$modulename" == "" ]; then echo $helptext exit 1 fi echo "republishing all versions of $modulename to registry $registry" tars=`curl https://registry.npmjs.org/$modulename 2> /dev/null | \ node -e "s='';process.stdin.on('data',function(b){s += b}).on('end',function(){ process.stdout.write(JSON.stringify(JSON.parse(s),null,' ')+'\n')})" | \ grep tarball | sed 's/[",]//g' | awk '{print $2}'` if [ "$?" != "0" ]; then echo "failed to download module $modulename" 2>1 exit $? fi download(){ curl -H "Bearer: $NPMTOKEN" "$1" > tartmp.tgz if [ "$?" != "0" ]; then echo "failed to download tar $1" 2>1 exit $? @@ -34,11 +52,18 @@ download(){ tar -xvf tartmp.tgz cd package echo "preparing to publish "$1 if [ "$reallyPublish" == "--really-publish" ]; then npm publish --registry $registry else echo "DRY RUN" echo "npm publish --registry $registry" fi rm -fr package } for tar in $tars; do download $tar done -
soldair revised this gist
Nov 29, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -34,7 +34,7 @@ download(){ tar -xvf tartmp.tgz cd package npm publish --registry $registry rm -fr package } -
soldair revised this gist
Nov 29, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ tars=`echo $json | json_pp | grep tarball | sed 's/[",]//g' | awk '{print $3}'` download(){ echo "downloading "$1 curl -H "Authorization: Bearer $NPMTOKEN" "$1" > tartmp.tgz if [ "$?" != "0" ]; then echo "failed to download tar $1" 2>1 exit $? -
soldair created this gist
Nov 29, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ #!/bin/bash mkdir -p ./publish-tmp cd publish-tmp if [ "$?" != "0" ]; then echo "failed to create publish tmp dir" exit 1 fi NPMTOKEN=`grep ^//registry.npmjs.org/:_authToken= ~/.npmrc | sed 's/_authToken=/ /' | awk '{print $2}'` registry="http://registry.npm.red" modulename=`echo "$1" | sed 's/\//%2f/'` json=`curl https://registry.npmjs.org/$modulename 2> /dev/null` if [ "$?" != "0" ]; then echo "failed to download module $modulename" 2>1 exit $? fi tars=`echo $json | json_pp | grep tarball | sed 's/[",]//g' | awk '{print $3}'` download(){ echo "downloading "$1 curl -H "Bearer: $NPMTOKEN" "$1" > tartmp.tgz if [ "$?" != "0" ]; then echo "failed to download tar $1" 2>1 exit $? fi tar -xvf tartmp.tgz cd package echo "npm publish --registry $registry" rm -fr package } for tar in $tars; do download $tar done