snyk-nuget-plugin
Advanced tools
Comparing version 1.22.0 to 1.22.1
@@ -22,5 +22,5 @@ "use strict"; | ||
const csprojContents = fs.readFileSync(csprojPath); | ||
let frameworks = []; | ||
let targetFrameworks = []; | ||
parseXML.parseString(csprojContents, (err, parsedCsprojContents) => { | ||
var _a, _b, _c, _d, _e; | ||
var _a, _b; | ||
if (err) { | ||
@@ -30,8 +30,11 @@ reject(new errors_1.FileNotProcessableError(err)); | ||
} | ||
const versionLoc = (_b = (_a = parsedCsprojContents === null || parsedCsprojContents === void 0 ? void 0 : parsedCsprojContents.Project) === null || _a === void 0 ? void 0 : _a.PropertyGroup) === null || _b === void 0 ? void 0 : _b[0]; | ||
const versions = [] | ||
.concat((((_c = versionLoc === null || versionLoc === void 0 ? void 0 : versionLoc.TargetFrameworkVersion) === null || _c === void 0 ? void 0 : _c[0]) || ((_d = versionLoc === null || versionLoc === void 0 ? void 0 : versionLoc.TargetFramework) === null || _d === void 0 ? void 0 : _d[0]) || ((_e = versionLoc === null || versionLoc === void 0 ? void 0 : versionLoc.TargetFrameworks) === null || _e === void 0 ? void 0 : _e[0]) || | ||
'').split(';')) | ||
.filter(Boolean); | ||
if (versions.length < 1) { | ||
const parsedTargetFrameworks = (_b = (_a = parsedCsprojContents === null || parsedCsprojContents === void 0 ? void 0 : parsedCsprojContents.Project) === null || _a === void 0 ? void 0 : _a.PropertyGroup) === null || _b === void 0 ? void 0 : _b.reduce((targetFrameworks, propertyGroup) => { | ||
var _a, _b, _c; | ||
const targetFrameworkSource = ((_a = propertyGroup === null || propertyGroup === void 0 ? void 0 : propertyGroup.TargetFrameworkVersion) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = propertyGroup === null || propertyGroup === void 0 ? void 0 : propertyGroup.TargetFramework) === null || _b === void 0 ? void 0 : _b[0]) || ((_c = propertyGroup === null || propertyGroup === void 0 ? void 0 : propertyGroup.TargetFrameworks) === null || _c === void 0 ? void 0 : _c[0]) || | ||
''; | ||
return targetFrameworks | ||
.concat(targetFrameworkSource.split(';')) | ||
.filter(Boolean); | ||
}, []); | ||
if (parsedTargetFrameworks.length < 1) { | ||
debug('Could not find TargetFrameworkVersion/TargetFramework' + | ||
@@ -41,8 +44,10 @@ '/TargetFrameworks defined in the Project.PropertyGroup field of ' + | ||
} | ||
frameworks = versions.map(framework_1.toReadableFramework).filter(Boolean); | ||
if (versions.length > 1 && frameworks.length < 1) { | ||
targetFrameworks = parsedTargetFrameworks | ||
.map(framework_1.toReadableFramework) | ||
.filter(Boolean); | ||
if (parsedTargetFrameworks.length > 1 && targetFrameworks.length < 1) { | ||
debug('Could not find valid/supported .NET version in csproj file located at' + | ||
csprojPath); | ||
} | ||
resolve(frameworks[0]); | ||
resolve(targetFrameworks[0]); | ||
}); | ||
@@ -49,0 +54,0 @@ }); |
@@ -7,3 +7,3 @@ { | ||
"test": "npm run lint && npm run unit-test", | ||
"unit-test": "tap --no-coverage test/*.test.ts --timeout=300", | ||
"unit-test": "jest && tap --no-coverage test/*.test.ts --timeout=300", | ||
"lint": "prettier --check \"./lib/**/*.ts\" && eslint -c .eslintrc.js \"./lib/**/*\"", | ||
@@ -46,2 +46,3 @@ "lint:fix": "prettier --write \"./lib/**/*.ts\" && eslint -c .eslintrc.js --fix \"./lib/**/*\"", | ||
"devDependencies": { | ||
"@types/jest": "^27.0.0", | ||
"@types/node": "^10", | ||
@@ -52,7 +53,9 @@ "@typescript-eslint/eslint-plugin": "^2.31.0", | ||
"eslint-config-prettier": "^6.15.0", | ||
"jest": "^27.0.6", | ||
"prettier": "^1.19.1", | ||
"tap": "^14.10.7", | ||
"ts-jest": "^27.0.4", | ||
"typescript": "^3.8.3" | ||
}, | ||
"version": "1.22.0" | ||
"version": "1.22.1" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69054
923
11