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
This commit is contained in:
Ruslan Lesiutin 2023-01-27 11:01:45 -08:00 коммит произвёл Facebook GitHub Bot
Родитель fac7859863
Коммит 8d5f8804d8
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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;
}