From 5c89b96a8559968d2bbddd4e7e7741a4fabb81fd Mon Sep 17 00:00:00 2001 From: wangjunzzz <> Date: Mon, 2 Feb 2026 08:48:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20cli=20create=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=A8=A1=E5=9D=97=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Lion/AbpPro/Cli/AbpProCliCoreModule.cs | 9 +++++++++ .../Lion/AbpPro/Cli/Commands/CreateCommand.cs | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/AbpProCliCoreModule.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/AbpProCliCoreModule.cs index 2532759f..28a19d46 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/AbpProCliCoreModule.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/AbpProCliCoreModule.cs @@ -78,6 +78,15 @@ public class AbpProCliCoreModule : AbpModule OldModuleName = "", }, + new AbpProTemplateOptions("pro-module", "pro-module", "模块") + { + ExcludeFiles = "aspnet-core,vben28,abp-nuget,docs,.github,LICENSE,.idea,Lion.AbpPro.Cli.slnx,Lion.AbpPro.slnx.sln.DotSettings.user", + ReplaceSuffix = ".slnx,.csproj,.cs,.cshtml,.json,.ci,.yml,.yaml,.nswag,.DotSettings,.env,Directory.Build.Lion.targets", + OldCompanyName = "MyCompanyName", + OldProjectName = "MyProjectName", + OldModuleName = "MyModuleName", + }, + new AbpProTemplateOptions("pro-nuget-gateways", "pro-nuget", "商业版本nuget网关版本") { ExcludeFiles = ".github,LICENSE,Readme.md,aspnet-core,.idea,MyCompanyName.MyProjectName.slnx,MyCompanyName.MyProjectName.slnx.DotSettings.user,Lion.AbpPro.Cli.sln", diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/CreateCommand.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/CreateCommand.cs index 7511e375..6ae20626 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/CreateCommand.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/CreateCommand.cs @@ -68,7 +68,15 @@ public class CreateCommand : IConsoleCommand, ITransientDependency GetUsageInfo(); return; } - + + //校验是否输入模块名称 + var moduleName = commandLineArgs.Options.GetOrNull(CommandOptions.Module.Short, CommandOptions.Module.Long); + if (templateOptions.Key == "pro-module" && moduleName.IsNullOrWhiteSpace()) + { + _logger.LogError("请输入公司名称lion.abp create -m 模块名称"); + GetUsageInfo(); + return; + } var version = commandLineArgs.Options.GetOrNull(CommandOptions.Version.Short, CommandOptions.Version.Long); var output = commandLineArgs.Options.GetOrNull(CommandOptions.Output.Short, CommandOptions.Output.Long); @@ -108,11 +116,11 @@ public class CreateCommand : IConsoleCommand, ITransientDependency if (output.IsNullOrWhiteSpace()) { // 复制源码到输出目录 - output = Path.Combine(CliPaths.Output, $"{companyName}{projectName}{version}"); + output = Path.Combine(CliPaths.Output, $"{companyName}{projectName}-{moduleName}-{version}"); } else { - output = Path.Combine(output, $"{companyName}{projectName}{version}"); + output = Path.Combine(output, $"{companyName}{projectName}-{moduleName}-{version}"); } @@ -126,7 +134,7 @@ public class CreateCommand : IConsoleCommand, ITransientDependency templateOptions.OldModuleName, companyName, projectName, - string.Empty, + moduleName, templateOptions.ReplaceSuffix, version, true);