update parser to v4

This commit is contained in:
Evgenii Korolevskii
2022-09-29 18:23:42 +02:00
parent cf081e76a2
commit 90642fa8c5
4 changed files with 1427 additions and 930 deletions

View File

@ -3,7 +3,7 @@ import * as path from 'path';
import * as core from '@actions/core';
import * as github from '@actions/github';
import * as xmlbuilder from 'xmlbuilder';
import * as xmlParser from 'fast-xml-parser';
import {XMLParser} from 'fast-xml-parser';
export function configAuthentication(
feedUrl: string,
@ -66,7 +66,12 @@ function writeFeedToFile(
if (fs.existsSync(existingFileLocation)) {
// get key from existing NuGet.config so NuGet/dotnet can match credentials
const curContents: string = fs.readFileSync(existingFileLocation, 'utf8');
const json = xmlParser.parse(curContents, {ignoreAttributes: false});
const parserOptions = {
ignoreAttributes: false
};
const parser = new XMLParser(parserOptions);
const json = parser.parse(curContents);
if (typeof json.configuration === 'undefined') {
throw new Error(`The provided NuGet.config seems invalid.`);