From 632ccbdfb97bc4aa7484106496626056c0589dd2 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 19 Apr 2021 14:25:42 +0300 Subject: [PATCH] Support nuget.config name formats --- src/authutil.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/authutil.ts b/src/authutil.ts index 463f0d3..e625f06 100644 --- a/src/authutil.ts +++ b/src/authutil.ts @@ -13,7 +13,7 @@ export function configAuthentication( ) { const existingNuGetConfig: string = path.resolve( processRoot, - existingFileLocation == '' ? 'nuget.config' : existingFileLocation + existingFileLocation == '' ? getExistingNugetConfig(processRoot) : existingFileLocation ); const tempNuGetConfig: string = path.resolve( @@ -25,6 +25,14 @@ export function configAuthentication( writeFeedToFile(feedUrl, existingNuGetConfig, tempNuGetConfig); } +function getExistingNugetConfig(processRoot: string) { + const configFileNames = fs.readdirSync(processRoot).filter(filename => filename.toLowerCase() == 'nuget.config') + if (configFileNames.length) { + return configFileNames[0]; + } + return 'nuget.config'; +} + function writeFeedToFile( feedUrl: string, existingFileLocation: string,