Skip to content

Commit

Permalink
save registry auth token before bootstrapping verdaccio (#35991)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
hoxyq authored and facebook-github-bot committed Jan 27, 2023
1 parent fac7859 commit 8d5f880
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/setup-verdaccio.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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;
}
Expand Down

0 comments on commit 8d5f880

Please sign in to comment.