Last active
May 13, 2020 06:22
Revisions
-
jspiro revised this gist
May 13, 2020 . 1 changed file with 4 additions and 3 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 @@ -3,6 +3,7 @@ scope=company-name any_scoped_package_name=secret_package url=artifactory.company.com repo=npm cd "$(dirname "$0")" || exit echo Please enter your email address: @@ -13,9 +14,9 @@ read -r token echo echo Generating .npmrc, keep this in "$(pwd -P)" echo echo registry=https://$url/artifactory/api/npm/$repo/ >.npmrc curl -u"$email:$token" https://$url/artifactory/api/$repo/auth >>.npmrc 2>/dev/null curl -u"$email:$token" https://$url/artifactory/api/npm/$repo/auth/$scope >>.npmrc 2>/dev/null sed -i '' -e "s!ENTER_YOUR_EMAIL_HERE!$email!" .npmrc echo Testing... echo -
jspiro created this gist
May 13, 2020 .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,40 @@ #!/bin/sh scope=company-name any_scoped_package_name=secret_package url=artifactory.company.com cd "$(dirname "$0")" || exit echo Please enter your email address: read -r email echo echo Please enter your Artifactory API token: read -r token echo echo Generating .npmrc, keep this in "$(pwd -P)" echo echo registry=https://$url/artifactory/api/npm/npm/ >.npmrc curl -u"$email:$token" https://$url/artifactory/api/npm/auth >>.npmrc 2>/dev/null curl -u"$email:$token" https://$url/artifactory/api/npm/npm/auth/$scope >>.npmrc 2>/dev/null sed -i '' -e "s!ENTER_YOUR_EMAIL_HERE!$email!" .npmrc echo Testing... echo if ! npm info @$scope/$any_scoped_package_name; then echo ===================================== echo Check your credentials and try again. exit fi echo echo ==================================================== echo Do you want to overwrite your user ~/.npmrc as well? echo echo You may get faster and more reliable package installation, but you will no longer echo be able to publish packages to the original NPM Private Registry, only to Artifactory. echo echo Do you want to use Artifactory instead of NPM Private Registry? echo \(Only 'yes' will be accepted\) read -r x [ "$x" = "yes" ] && cp .npmrc ~/.npmrc echo Done.