Browse Source

feat: cli create 添加创建模块指令

main
wangjunzzz 2 months ago
parent
commit
5c89b96a85
  1. 9
      aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/AbpProCliCoreModule.cs
  2. 14
      aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/CreateCommand.cs

9
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",

14
aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/CreateCommand.cs

@ -69,6 +69,14 @@ public class CreateCommand : IConsoleCommand, ITransientDependency
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);

Loading…
Cancel
Save