Browse Source
Merge pull request #8696 from abpframework/volo/issues/6308
cli: Added min-max version for NpmPackageInfo
pull/8720/head
Alper Ebicoglu
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
7 deletions
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackageInfo.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
|
|
@ -5,5 +5,9 @@ |
|
|
public string Name { get; set; } |
|
|
public string Name { get; set; } |
|
|
|
|
|
|
|
|
public NpmApplicationType ApplicationType { get; set; } |
|
|
public NpmApplicationType ApplicationType { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
public string MinVersion { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
public string MaxVersion { get; set; } |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
@ -135,24 +135,25 @@ namespace Volo.Abp.Cli.ProjectModification |
|
|
|
|
|
|
|
|
private ModuleWithMastersInfo RemoveIncompatiblePackages(ModuleWithMastersInfo module, string version) |
|
|
private ModuleWithMastersInfo RemoveIncompatiblePackages(ModuleWithMastersInfo module, string version) |
|
|
{ |
|
|
{ |
|
|
module.NugetPackages.RemoveAll(np => IsPackageInCompatible(np, version)); |
|
|
module.NugetPackages.RemoveAll(np => IsPackageInCompatible(np.MinVersion, np.MaxVersion, version)); |
|
|
|
|
|
module.NpmPackages.RemoveAll(np => IsPackageInCompatible(np.MinVersion, np.MaxVersion, version)); |
|
|
return module; |
|
|
return module; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private bool IsPackageInCompatible(NugetPackageInfo package, string version) |
|
|
private bool IsPackageInCompatible(string minVersion, string maxVersion, string version) |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
if (!string.IsNullOrWhiteSpace(package.MinVersion)) |
|
|
if (!string.IsNullOrWhiteSpace(minVersion)) |
|
|
{ |
|
|
{ |
|
|
if (SemanticVersion.Parse(package.MinVersion) > SemanticVersion.Parse(version)) |
|
|
if (SemanticVersion.Parse(minVersion) > SemanticVersion.Parse(version)) |
|
|
{ |
|
|
{ |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (!string.IsNullOrWhiteSpace(package.MaxVersion)) |
|
|
if (!string.IsNullOrWhiteSpace(maxVersion)) |
|
|
{ |
|
|
{ |
|
|
if (SemanticVersion.Parse(package.MaxVersion) < SemanticVersion.Parse(version)) |
|
|
if (SemanticVersion.Parse(maxVersion) < SemanticVersion.Parse(version)) |
|
|
{ |
|
|
{ |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|