From b0a0a714cd576cd60d6dce00bc095f3c9c0d7bc1 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sun, 22 Sep 2024 10:43:00 +0200 Subject: [PATCH] chore(npm): log hostRules npmrc logic (#30274) Co-authored-by: Sebastian Poxhofer --- lib/modules/manager/npm/post-update/rules.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/modules/manager/npm/post-update/rules.ts b/lib/modules/manager/npm/post-update/rules.ts index 2da03556713fb2..0814bfa334f431 100644 --- a/lib/modules/manager/npm/post-update/rules.ts +++ b/lib/modules/manager/npm/post-update/rules.ts @@ -1,4 +1,5 @@ import is from '@sindresorhus/is'; +import { logger } from '../../../../logger'; import * as hostRules from '../../../../util/host-rules'; import { regEx } from '../../../../util/regex'; import { toBase64 } from '../../../../util/string'; @@ -18,8 +19,10 @@ export function processHostRules(): HostRulesResult { const npmHostRules = hostRules.findAll({ hostType: 'npm', }); + logger.debug(`Found ${npmHostRules.length} npm host rule(s)`); for (const hostRule of npmHostRules) { if (!hostRule.resolvedHost) { + logger.debug('Skipping host rule without resolved host'); continue; } @@ -27,6 +30,7 @@ export function processHostRules(): HostRulesResult { // Should never be necessary as if we have a resolvedHost, there has to be a matchHost // istanbul ignore next if (!matchedHost) { + logger.debug('Skipping host rule without matchHost'); continue; } @@ -38,6 +42,7 @@ export function processHostRules(): HostRulesResult { if (hostRule.token) { const key = hostRule.authType === 'Basic' ? '_auth' : '_authToken'; + logger.debug(`Adding npmrc entry for ${cleanedUri} with key ${key}`); additionalNpmrcContent.push(`${cleanedUri}:${key}=${hostRule.token}`); if (hostRule.authType === 'Basic') { @@ -60,6 +65,9 @@ export function processHostRules(): HostRulesResult { } if (is.string(hostRule.username) && is.string(hostRule.password)) { + logger.debug( + `Adding npmrc entry for ${cleanedUri} with username/password`, + ); const password = toBase64(hostRule.password); additionalNpmrcContent.push( `${cleanedUri}:username=${hostRule.username}`,