From 83828ae7089c59d72109a19d1778f2bf97becd33 Mon Sep 17 00:00:00 2001
From: Hanpaopao <510423039@qq.com>
Date: Tue, 11 Feb 2025 14:48:08 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=87=E7=BA=A7abp9.0.4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Readme.md | 6 +-
aspnet-core/Directory.Build.Volo.targets | 180 +++++++++---------
.../Lion/AbpPro/Cli/Args/CommandOptions.cs | 2 +-
.../AbpPro/Cli/Auth/GithubTokenAuthService.cs | 4 +
.../Lion/AbpPro/Cli/Commands/CreateCommand.cs | 22 ++-
.../Lion/AbpPro/Cli/Commands/NewCommand.cs | 25 ++-
.../pro-module/Directory.Build.Volo.targets | 180 +++++++++---------
.../service/Directory.Build.Volo.targets | 180 +++++++++---------
8 files changed, 311 insertions(+), 288 deletions(-)
diff --git a/Readme.md b/Readme.md
index 78056af0..960920d6 100644
--- a/Readme.md
+++ b/Readme.md
@@ -35,20 +35,20 @@ dotnet tool update Lion.AbpPro.Cli -g
- 源码版本
```bash
-lion.abp new -t pro -c 公司名称 -p 项目名称 -v 版本(默认LastRelease) -o 默认当前控制台执行目录
+lion.abp new -t pro -c 公司名称 -p 项目名称 -v 版本(默认LastRelease)
```
- nuget版本
```bash
-lion.abp new -t pro-nuget -c 公司名称 -p 项目名称 -v 版本(默认LastRelease) -o 默认当前控制台执行目录
+lion.abp new -t pro-nuget -c 公司名称 -p 项目名称 -v 版本(默认LastRelease)
```
- 模块
```bash
-lion.abp new -t pro-module -c 公司名称 -p 项目名称 -v 版本(默认LastRelease) -o 默认当前控制台执行目录
+lion.abp new -t pro-module -c 公司名称 -p 项目名称 -v 版本(默认LastRelease)
```
diff --git a/aspnet-core/Directory.Build.Volo.targets b/aspnet-core/Directory.Build.Volo.targets
index ca4fa149..143bcc6c 100644
--- a/aspnet-core/Directory.Build.Volo.targets
+++ b/aspnet-core/Directory.Build.Volo.targets
@@ -1,94 +1,94 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Args/CommandOptions.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Args/CommandOptions.cs
index b1cddb09..fabb09d4 100644
--- a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Args/CommandOptions.cs
+++ b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Args/CommandOptions.cs
@@ -42,7 +42,7 @@ public static class CommandOptions
///
/// 输出目录
///
- public static class OutputFolder
+ public static class Output
{
public const string Short = "o";
public const string Long = "output";
diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Auth/GithubTokenAuthService.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Auth/GithubTokenAuthService.cs
index e9bd8f8e..e8ecd258 100644
--- a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Auth/GithubTokenAuthService.cs
+++ b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Auth/GithubTokenAuthService.cs
@@ -19,6 +19,10 @@ public class GithubTokenAuthService : ITokenAuthService, ITransientDependency
public async Task GetAsync()
{
+ if (!File.Exists(CliPaths.AccessToken))
+ {
+ return string.Empty;
+ }
return await File.ReadAllTextAsync(CliPaths.AccessToken);
}
}
\ No newline at end of file
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 68a49402..218efdb1 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
@@ -71,6 +71,7 @@ public class CreateCommand : IConsoleCommand, ITransientDependency
}
var version = commandLineArgs.Options.GetOrNull(CommandOptions.Version.Short, CommandOptions.Version.Long);
+ var output = commandLineArgs.Options.GetOrNull(CommandOptions.Output.Short, CommandOptions.Output.Long);
#endregion
@@ -105,13 +106,22 @@ public class CreateCommand : IConsoleCommand, ITransientDependency
var extractPath = _sourceCodeManager.ExtractProjectZip(localFilePath, _cliOptions.RepositoryId, version);
var contentPath = templateOptions.Name == "pro" ? extractPath : Path.Combine(extractPath, ".templates", templateOptions.Name);
- // 复制源码到输出目录
- var destOutput = Path.Combine(CliPaths.Output, $"{companyName}-{projectName}-{version}");
+ if (output.IsNullOrWhiteSpace())
+ {
+ // 复制源码到输出目录
+ output = Path.Combine(CliPaths.Output, $"{companyName}{projectName}{version}");
+ }
+ else
+ {
+ output = Path.Combine(output, $"{companyName}{projectName}{version}");
+ }
+
+
- DirectoryAndFileHelper.CopyFolder(contentPath, destOutput, templateOptions.ExcludeFiles);
+ DirectoryAndFileHelper.CopyFolder(contentPath, output, templateOptions.ExcludeFiles);
ReplaceHelper.ReplaceTemplates(
- destOutput,
+ output,
templateOptions.OldCompanyName,
templateOptions.OldProjectName,
templateOptions.OldModuleName,
@@ -121,9 +131,9 @@ public class CreateCommand : IConsoleCommand, ITransientDependency
templateOptions.ReplaceSuffix,
version);
- _logger.LogInformation($"创建模板成功,请查阅----->: {destOutput}");
+ _logger.LogInformation($"创建模板成功,请查阅----->: {output}");
- ProcessHelper.OpenExplorer(destOutput);
+ ProcessHelper.OpenExplorer(output);
}
diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/NewCommand.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/NewCommand.cs
index 2f4ad77d..67a726e0 100644
--- a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/NewCommand.cs
+++ b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/NewCommand.cs
@@ -78,6 +78,7 @@ public class NewCommand : IConsoleCommand, ITransientDependency
}
var version = commandLineArgs.Options.GetOrNull(CommandOptions.Version.Short, CommandOptions.Version.Long);
+ var output = commandLineArgs.Options.GetOrNull(CommandOptions.Output.Short, CommandOptions.Output.Long);
#endregion
@@ -112,18 +113,26 @@ public class NewCommand : IConsoleCommand, ITransientDependency
var extractPath = _sourceCodeManager.ExtractProjectZip(localFilePath, _cliOptions.RepositoryId, version);
var contentPath = templateOptions.Name == "pro" ? extractPath : Path.Combine(extractPath, "templates", templateOptions.Name);
- // 复制源码到输出目录
- var destOutput = Path.Combine(CliPaths.Output, $"{companyName}-{projectName}-{version}");
+ if (output.IsNullOrWhiteSpace())
+ {
+ // 复制源码到输出目录
+ output = Path.Combine(CliPaths.Output, $"{companyName}{projectName}{version}");
- if (templateOptions.Key == "pro-module")
+ if (templateOptions.Key == "pro-module")
+ {
+ output = Path.Combine(CliPaths.Output, $"{companyName}-{projectName}-{moduleName}-{version}");
+ }
+ }
+ else
{
- destOutput = Path.Combine(CliPaths.Output, $"{companyName}-{projectName}-{moduleName}-{version}");
+ output = Path.Combine(output, $"{companyName}{projectName}{moduleName}{version}");
}
+
- DirectoryAndFileHelper.CopyFolder(contentPath, destOutput, templateOptions.ExcludeFiles);
+ DirectoryAndFileHelper.CopyFolder(contentPath, output, templateOptions.ExcludeFiles);
ReplaceHelper.ReplaceTemplates(
- destOutput,
+ output,
templateOptions.OldCompanyName,
templateOptions.OldProjectName,
templateOptions.OldModuleName,
@@ -133,9 +142,9 @@ public class NewCommand : IConsoleCommand, ITransientDependency
templateOptions.ReplaceSuffix,
version);
- _logger.LogInformation($"创建模板成功,请查阅----->: {destOutput}");
+ _logger.LogInformation($"创建模板成功,请查阅----->: {output}");
- ProcessHelper.OpenExplorer(destOutput);
+ ProcessHelper.OpenExplorer(output);
}
public void GetUsageInfo()
diff --git a/templates/pro-module/Directory.Build.Volo.targets b/templates/pro-module/Directory.Build.Volo.targets
index ca4fa149..143bcc6c 100644
--- a/templates/pro-module/Directory.Build.Volo.targets
+++ b/templates/pro-module/Directory.Build.Volo.targets
@@ -1,94 +1,94 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/templates/pro-nuget/service/Directory.Build.Volo.targets b/templates/pro-nuget/service/Directory.Build.Volo.targets
index ca4fa149..143bcc6c 100644
--- a/templates/pro-nuget/service/Directory.Build.Volo.targets
+++ b/templates/pro-nuget/service/Directory.Build.Volo.targets
@@ -1,94 +1,94 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file