From 5694858959d9f89fb5ddfab5bf4f5a7abb5ca06d Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 27 Dec 2023 22:17:32 +0300 Subject: [PATCH] Update npm config fix command to use global flag --- jfrog-oauth/run.sh | 6 +++--- jfrog-token/run.sh | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/jfrog-oauth/run.sh b/jfrog-oauth/run.sh index ce5509f..cd08efc 100644 --- a/jfrog-oauth/run.sh +++ b/jfrog-oauth/run.sh @@ -28,13 +28,13 @@ else jf npmc --global --repo-resolve "${REPOSITORY_NPM}" fi cat << EOF > ~/.npmrc -email = ${ARTIFACTORY_EMAIL} -registry = ${JFROG_URL}/artifactory/api/npm/${REPOSITORY_NPM} +email=${ARTIFACTORY_EMAIL} +registry=${JFROG_URL}/artifactory/api/npm/${REPOSITORY_NPM} EOF jf rt curl /api/npm/auth >> ~/.npmrc # if npm version is greater than or equal to 9.0.0, use the new npmrc format if [ "$(npm --version | cut -d. -f1)" -ge 9 ]; then - npm config fix + npm config fix --global fi fi diff --git a/jfrog-token/run.sh b/jfrog-token/run.sh index 178cbdc..cd08efc 100644 --- a/jfrog-token/run.sh +++ b/jfrog-token/run.sh @@ -28,10 +28,14 @@ else jf npmc --global --repo-resolve "${REPOSITORY_NPM}" fi cat << EOF > ~/.npmrc -email = ${ARTIFACTORY_EMAIL} -registry = ${JFROG_URL}/artifactory/api/npm/${REPOSITORY_NPM} +email=${ARTIFACTORY_EMAIL} +registry=${JFROG_URL}/artifactory/api/npm/${REPOSITORY_NPM} EOF jf rt curl /api/npm/auth >> ~/.npmrc + # if npm version is greater than or equal to 9.0.0, use the new npmrc format + if [ "$(npm --version | cut -d. -f1)" -ge 9 ]; then + npm config fix --global + fi fi # Configure the `pip` to use the Artifactory "python" repository.