Merge pull request #7361 from abpframework/issues/7345

Cli: Remove warnings from version list output
pull/7386/head
Alper Ebicoglu 4 years ago committed by GitHub
commit da59dbcd59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -345,11 +345,20 @@ namespace Volo.Abp.Cli.ProjectModification
protected virtual List<string> GetPackageVersionList(JProperty package)
{
var versionListAsJson = CmdHelper.RunCmdAndGetOutput($"npm show {package.Name} versions");
var output = CmdHelper.RunCmdAndGetOutput($"npm show {package.Name} versions --json");
var versionListAsJson = ExtractVersions(output);
return JsonConvert.DeserializeObject<string[]>(versionListAsJson)
.OrderByDescending(SemanticVersion.Parse, new VersionComparer()).ToList();
}
protected virtual string ExtractVersions(string output)
{
var arrayStart = output.IndexOf('[');
return output.Substring(arrayStart, output.IndexOf(']') - arrayStart + 1);
}
protected virtual bool SpecifiedVersionExists(string version, JProperty package)
{
var versionList = GetPackageVersionList(package);

Loading…
Cancel
Save