mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
refactor(npm): npmrc string check
This commit is contained in:
parent
e541f3ed28
commit
486decbee6
1 changed files with 4 additions and 4 deletions
|
@ -102,11 +102,11 @@ export async function extractPackageFile(
|
||||||
await deleteLocalFile(npmrcFileName);
|
await deleteLocalFile(npmrcFileName);
|
||||||
} else {
|
} else {
|
||||||
npmrc = await readLocalFile(npmrcFileName, 'utf8');
|
npmrc = await readLocalFile(npmrcFileName, 'utf8');
|
||||||
if (npmrc?.includes('package-lock')) {
|
if (is.string(npmrc)) {
|
||||||
|
if (npmrc.includes('package-lock')) {
|
||||||
logger.debug('Stripping package-lock setting from npmrc');
|
logger.debug('Stripping package-lock setting from npmrc');
|
||||||
npmrc = npmrc.replace(/(^|\n)package-lock.*?(\n|$)/g, '\n');
|
npmrc = npmrc.replace(/(^|\n)package-lock.*?(\n|$)/g, '\n');
|
||||||
}
|
}
|
||||||
if (is.string(npmrc)) {
|
|
||||||
if (npmrc.includes('=${') && getAdminConfig().trustLevel !== 'high') {
|
if (npmrc.includes('=${') && getAdminConfig().trustLevel !== 'high') {
|
||||||
logger.debug('Discarding .npmrc file with variables');
|
logger.debug('Discarding .npmrc file with variables');
|
||||||
ignoreNpmrcFile = true;
|
ignoreNpmrcFile = true;
|
||||||
|
|
Loading…
Reference in a new issue