Skip to content

Commit

Permalink
Support nuget.config name formats
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Safonkin committed Apr 19, 2021
1 parent 5a201f5 commit 632ccbd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/authutil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down

0 comments on commit 632ccbd

Please sign in to comment.