From 7e2ffcb102f90d79c429c1ac1bf7065c37948f92 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 18 Dec 2023 21:00:57 +0800 Subject: [PATCH] Skip opening web browser after `abp new` command. Resolve #18236 --- .../Volo/Abp/Cli/Commands/NewCommand.cs | 9 ++++++--- .../Abp/Cli/Commands/ProjectCreationCommandBase.cs | 11 ++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 7c477da368..b6fd6e2075 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -124,7 +124,10 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien await ConfigurePwaSupportForAngular(projectArgs); - OpenRelatedWebPage(projectArgs, template, isTiered, commandLineArgs); + if (!commandLineArgs.Options.ContainsKey(Options.NoOpenWebPage.Long)) + { + OpenRelatedWebPage(projectArgs, template, isTiered, commandLineArgs); + } } private Task CheckCreatingRequirements(ProjectBuildArgs projectArgs) @@ -162,8 +165,8 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien requirementWarningMessages.AddFirst("NOTICE: The following tools are required to run your solution:"); await EventBus.PublishAsync(new ProjectPostRequirementsCheckedEvent - { - Message = requirementWarningMessages.JoinAsString(Environment.NewLine) + { + Message = requirementWarningMessages.JoinAsString(Environment.NewLine) }, false); foreach (var error in requirementWarningMessages) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs index 1ad125b275..a2226fa6e2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs @@ -425,7 +425,7 @@ public abstract class ProjectCreationCommandBase { return; } - + var isWebassembly = projectArgs.UiFramework == UiFramework.Blazor; var message = isWebassembly ? "Generating bundles for Blazor Wasm" : "Generating bundles for MAUI Blazor"; Logger.LogInformation(message + "..."); @@ -440,7 +440,7 @@ public abstract class ProjectCreationCommandBase { path = Path.Combine(path, "apps"); } - + var directory = Path.GetDirectoryName( Directory.GetFiles(path, isWebassembly ? "*.Blazor.csproj" : "*.MauiBlazor.csproj", SearchOption.AllDirectories).First() ); @@ -455,7 +455,7 @@ public abstract class ProjectCreationCommandBase { return true; } - + if (projectArgs.TemplateName == MicroserviceProTemplate.TemplateName && projectArgs.UiFramework is UiFramework.Blazor) { return true; @@ -907,5 +907,10 @@ public abstract class ProjectCreationCommandBase { public const string Long = "theme-style"; } + + public static class NoOpenWebPage + { + public const string Long = "no-open"; + } } }