From 8d5f8804d88d7daf45766e525f8d363d937bdef5 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Fri, 27 Jan 2023 11:01:45 -0800 Subject: [PATCH] save registry auth token before bootstrapping verdaccio (#35991) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35991 Changelog: [Internal] While cherry-picking all this logic to `0.71-stable` branch, we've discovered several issues where some packages were failing to be published on Verdaccio proxy This was failing only on node v16+, after some research, I've noticed that there might be a race-condition and npm unable to grab this token before first `npm publish` executes Although this still work well on `main` branch, I am backporting it to keep aligned with `0.71-stable` Reviewed By: christophpurrer, cortinico Differential Revision: D42806081 fbshipit-source-id: af244d26ea529e6085ed5b2d731623dfaf78a14d --- scripts/setup-verdaccio.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/setup-verdaccio.js b/scripts/setup-verdaccio.js index 3dc32a261d..26e8559e74 100644 --- a/scripts/setup-verdaccio.js +++ b/scripts/setup-verdaccio.js @@ -28,6 +28,10 @@ function setupVerdaccio( ); } + execSync('echo "//localhost:4873/:_authToken=secretToken" > .npmrc', { + cwd: reactNativeRootPath, + }); + const verdaccioProcess = spawn( 'npx', ['verdaccio@5.16.3', '--config', verdaccioConfigPath], @@ -37,11 +41,7 @@ function setupVerdaccio( const VERDACCIO_PID = verdaccioProcess.pid; execSync('npx wait-on@6.0.1 http://localhost:4873'); - execSync('npm set registry http://localhost:4873'); - execSync('echo "//localhost:4873/:_authToken=secretToken" > .npmrc', { - cwd: reactNativeRootPath, - }); return VERDACCIO_PID; }