Browse Source

Fix: CLI update command replaces first character of NPM version with ^

resolves https://github.com/volosoft/volo/issues/1497
pull/3193/head
Yunus Emre Kalkan 7 years ago
parent
commit
6d16655c23
  1. 9
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs

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

@ -99,26 +99,21 @@ namespace Volo.Abp.Cli.ProjectModification
protected virtual async Task<bool> TryUpdatePackage(string file, JProperty package, protected virtual async Task<bool> TryUpdatePackage(string file, JProperty package,
bool includePreviews = false, bool switchToStable = false) bool includePreviews = false, bool switchToStable = false)
{ {
var updated = false;
var currentVersion = (string)package.Value; var currentVersion = (string)package.Value;
var version = await GetLatestVersion(package, currentVersion, includePreviews, switchToStable); var version = await GetLatestVersion(package, currentVersion, includePreviews, switchToStable);
var versionWithPrefix = $"^{version}"; var versionWithPrefix = $"~{version}";
if (versionWithPrefix == currentVersion) if (versionWithPrefix == currentVersion)
{ {
return false; return false;
} }
else
{
updated = true;
}
package.Value.Replace(versionWithPrefix); package.Value.Replace(versionWithPrefix);
Logger.LogInformation($"Updated {package.Name} to {version} in {file.Replace(Directory.GetCurrentDirectory(), "")}."); Logger.LogInformation($"Updated {package.Name} to {version} in {file.Replace(Directory.GetCurrentDirectory(), "")}.");
return updated; return true;
} }
protected virtual async Task<string> GetLatestVersion(JProperty package, string currentVersion, protected virtual async Task<string> GetLatestVersion(JProperty package, string currentVersion,

Loading…
Cancel
Save