From 4b39e96c2862f51a5acee88d35683558f86c791c Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Thu, 7 May 2020 12:00:16 -0700 Subject: [PATCH] Ensure the npm registry is used during "Publish" workflow (#4286) Unset the `npm_config_registry` env var which yarn overwrites to the yarn registry, which we don't want since the `.npmrc` file that gets created is configured to the npm registry. --- lerna.json | 25 ++++++++++++------------- utils/publish-legacy.sh | 4 ++-- utils/publish.sh | 4 ++++ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/lerna.json b/lerna.json index 22f466334..ec5e4098c 100644 --- a/lerna.json +++ b/lerna.json @@ -1,14 +1,13 @@ { - "npmClient": "yarn", - "useWorkspaces": true, - "packages": ["packages/*"], - "command": { - "publish": { - "npmClient": "npm", - "allowBranch": ["master", "canary"], - "registry": "https://registry.npmjs.org/" - } - }, - "version": "independent" - } - \ No newline at end of file + "npmClient": "yarn", + "useWorkspaces": true, + "packages": ["packages/*"], + "command": { + "publish": { + "npmClient": "npm", + "allowBranch": ["master"], + "registry": "https://registry.npmjs.org/" + } + }, + "version": "independent" +} diff --git a/utils/publish-legacy.sh b/utils/publish-legacy.sh index bd7c15eea..c050157c8 100755 --- a/utils/publish-legacy.sh +++ b/utils/publish-legacy.sh @@ -23,6 +23,6 @@ for tag in $tags; do npm_tag="--tag canary" fi - echo "Running \`npm publish --registry=https://registry.npmjs.com $npm_tag\` in \"$(pwd)\"" - echo "DRY: npm publish --registry=https://registry.npmjs.com $npm_tag" + echo "Running \`npm publish $npm_tag\` in \"$(pwd)\"" + npm publish $npm_tag done diff --git a/utils/publish.sh b/utils/publish.sh index 15eb15a22..a0a306a72 100755 --- a/utils/publish.sh +++ b/utils/publish.sh @@ -1,6 +1,10 @@ #!/bin/bash set -euo pipefail +# `yarn` overwrites this value to use the yarn registry, which we +# can't publish to. Unset so that the default npm registry is used. +unset npm_config_registry + __dirname="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo "__dirname: ${__dirname}"