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

2313
dist/index.js vendored

File diff suppressed because it is too large Load Diff

33
package-lock.json generated
View File

@ -14,7 +14,7 @@
"@actions/github": "^1.1.0", "@actions/github": "^1.1.0",
"@actions/http-client": "^2.0.1", "@actions/http-client": "^2.0.1",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"fast-xml-parser": "^3.15.1", "fast-xml-parser": "^4.0.10",
"semver": "^6.3.0", "semver": "^6.3.0",
"xmlbuilder": "^13.0.2" "xmlbuilder": "^13.0.2"
}, },
@ -1992,12 +1992,14 @@
"dev": true "dev": true
}, },
"node_modules/fast-xml-parser": { "node_modules/fast-xml-parser": {
"version": "3.17.4", "version": "4.0.10",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-3.17.4.tgz", "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.0.10.tgz",
"integrity": "sha512-qudnQuyYBgnvzf5Lj/yxMcf4L9NcVWihXJg7CiU1L+oUCq8MUnFEfH2/nXR/W5uq+yvUN1h7z6s7vs2v1WkL1A==", "integrity": "sha512-mYMMIk7Ho1QOiedyvafdyPamn1Vlda+5n95lcn0g79UiCQoLQ2xfPQ8m3pcxBMpVaftYXtoIE2wrNTjmLQnnkg==",
"hasInstallScript": true, "dependencies": {
"strnum": "^1.0.5"
},
"bin": { "bin": {
"xml2js": "cli.js" "fxparser": "src/cli/cli.js"
}, },
"funding": { "funding": {
"type": "paypal", "type": "paypal",
@ -4204,6 +4206,11 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/strnum": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz",
"integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA=="
},
"node_modules/supports-color": { "node_modules/supports-color": {
"version": "7.1.0", "version": "7.1.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
@ -6293,9 +6300,12 @@
"dev": true "dev": true
}, },
"fast-xml-parser": { "fast-xml-parser": {
"version": "3.17.4", "version": "4.0.10",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-3.17.4.tgz", "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.0.10.tgz",
"integrity": "sha512-qudnQuyYBgnvzf5Lj/yxMcf4L9NcVWihXJg7CiU1L+oUCq8MUnFEfH2/nXR/W5uq+yvUN1h7z6s7vs2v1WkL1A==" "integrity": "sha512-mYMMIk7Ho1QOiedyvafdyPamn1Vlda+5n95lcn0g79UiCQoLQ2xfPQ8m3pcxBMpVaftYXtoIE2wrNTjmLQnnkg==",
"requires": {
"strnum": "^1.0.5"
}
}, },
"fb-watchman": { "fb-watchman": {
"version": "2.0.1", "version": "2.0.1",
@ -7967,6 +7977,11 @@
"integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
"dev": true "dev": true
}, },
"strnum": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz",
"integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA=="
},
"supports-color": { "supports-color": {
"version": "7.1.0", "version": "7.1.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",

View File

@ -29,7 +29,7 @@
"@actions/github": "^1.1.0", "@actions/github": "^1.1.0",
"@actions/http-client": "^2.0.1", "@actions/http-client": "^2.0.1",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"fast-xml-parser": "^3.15.1", "fast-xml-parser": "^4.0.10",
"semver": "^6.3.0", "semver": "^6.3.0",
"xmlbuilder": "^13.0.2" "xmlbuilder": "^13.0.2"
}, },

View File

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