Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function queryLatestMatch(versionSpec: string): string {
const npmRunner = new tr.ToolRunner("npm");
npmRunner.arg(["show", "tfx-cli", "versions", "--json"]);
const result = npmRunner.execSync({ failOnStdErr: false, silent: true, ignoreReturnCode: false} as tr.IExecOptions);
if (result.code === 0)
{
let versions: string[] = JSON.parse(result.stdout.trim());
let version: string = toolLib.evaluateVersions(versions, versionSpec);
return version;
}
return "";
}