Browse Source

Cli Update Command: Add parameter for selecting which package type to update

resolves https://github.com/abpframework/abp/issues/1644
pull/1653/head
Yunus Emre Kalkan 7 years ago
parent
commit
b3e74314c0
  1. 2
      docs/en/CLI.md
  2. 26
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs

2
docs/en/CLI.md

@ -123,6 +123,8 @@ abp update [options]
#### Options
* `--include-previews` or `-p`: Includes preview, beta and rc packages while checking the latest versions.
* `--npm`: Only updates NPM packages
* `--nuget`: Only updates NuGet packages
### help

26
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
@ -43,8 +44,21 @@ namespace Volo.Abp.Cli.Commands
public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
{
await UpdateNugetPackages(commandLineArgs);
UpdateNpmPackages();
var updateNpm = commandLineArgs.Options.ContainsKey(Options.Packages.Npm);
var updateNuget = commandLineArgs.Options.ContainsKey(Options.Packages.NuGet);
var both = (updateNuget && updateNpm) || (!updateNuget && !updateNpm);
if (updateNpm || both)
{
await UpdateNugetPackages(commandLineArgs);
}
if (updateNpm || both)
{
UpdateNpmPackages();
}
}
private void UpdateNpmPackages()
@ -99,6 +113,8 @@ namespace Volo.Abp.Cli.Commands
sb.AppendLine("");
sb.AppendLine("Options:");
sb.AppendLine("-p|--include-previews (if supported by the template)");
sb.AppendLine("--npm (Only updates NPM packages)");
sb.AppendLine("--nuget (Only updates Nuget packages)");
sb.AppendLine("");
sb.AppendLine("Some examples:");
sb.AppendLine("");
@ -123,6 +139,12 @@ namespace Volo.Abp.Cli.Commands
public const string Short = "p";
public const string Long = "include-previews";
}
public static class Packages
{
public const string Npm = "npm";
public const string NuGet = "nuget";
}
}
}
}

Loading…
Cancel
Save