fix(core): fix local registry not being considered when using bun (#30459)

This commit is contained in:
Tine Kondo 2025-03-23 19:29:31 +01:00 committed by GitHub
parent 3be73ede0f
commit cecd60710b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,24 +49,28 @@ export function startLocalRegistry({
); );
const registry = `http://${listenAddress}:${port}`; const registry = `http://${listenAddress}:${port}`;
const authToken = 'secretVerdaccioToken';
console.log(`Local registry started on ${registry}`); console.log(`Local registry started on ${registry}`);
process.env.npm_config_registry = registry; process.env.npm_config_registry = registry;
execSync( execSync(
`npm config set //${listenAddress}:${port}/:_authToken "secretVerdaccioToken" --ws=false`, `npm config set //${listenAddress}:${port}/:_authToken "${authToken}" --ws=false`,
{ {
windowsHide: false, windowsHide: false,
} }
); );
// bun
process.env.BUN_CONFIG_REGISTRY = registry;
process.env.BUN_CONFIG_TOKEN = authToken;
// yarnv1 // yarnv1
process.env.YARN_REGISTRY = registry; process.env.YARN_REGISTRY = registry;
// yarnv2 // yarnv2
process.env.YARN_NPM_REGISTRY_SERVER = registry; process.env.YARN_NPM_REGISTRY_SERVER = registry;
process.env.YARN_UNSAFE_HTTP_WHITELIST = listenAddress; process.env.YARN_UNSAFE_HTTP_WHITELIST = listenAddress;
console.log('Set npm and yarn config registry to ' + registry); console.log('Set npm, bun, and yarn config registry to ' + registry);
resolve(() => { resolve(() => {
childProcess.kill(); childProcess.kill();