Browse Source

Merge pull request #7386 from abpframework/auto-merge/rel-4-2/114

Merge branch dev with rel-4.2
pull/7414/head
maliming 6 years ago
committed by GitHub
parent
commit
4e16da331f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs

11
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs

@ -345,11 +345,20 @@ namespace Volo.Abp.Cli.ProjectModification
protected virtual List<string> GetPackageVersionList(JProperty package) 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) return JsonConvert.DeserializeObject<string[]>(versionListAsJson)
.OrderByDescending(SemanticVersion.Parse, new VersionComparer()).ToList(); .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) protected virtual bool SpecifiedVersionExists(string version, JProperty package)
{ {
var versionList = GetPackageVersionList(package); var versionList = GetPackageVersionList(package);

Loading…
Cancel
Save