Browse Source
Merge pull request #7361 from abpframework/issues/7345
Cli: Remove warnings from version list output
pull/7386/head
Alper Ebicoglu
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
10 additions and
1 deletions
-
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) |
|
|
|
{ |
|
|
|
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); |
|
|
|
|