From 8f498eb5905df308d6fefa99255ce1310c387c78 Mon Sep 17 00:00:00 2001 From: j0nimost Date: Mon, 16 May 2022 10:43:47 +0300 Subject: [PATCH 1/8] Added checker for Struct types --- framework/src/Volo.Abp.Core/Volo/Abp/Check.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs index b20ef0f247..99c1148971 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs @@ -162,4 +162,17 @@ public static class Check return value; } + + public static T NotDefault( + T value, + [InvokerParameterName][NotNull] string parameterName) + where T : struct + { + if(value.Equals(default(T))) + { + throw new ArgumentException($"{parameterName} has a default value or is empty!", parameterName); + } + + return value; + } } From 643d045cc42296f90404d20f74cc836771a5c6ba Mon Sep 17 00:00:00 2001 From: j0nimost Date: Thu, 19 May 2022 15:39:28 +0300 Subject: [PATCH 2/8] fix merge error --- framework/src/Volo.Abp.Core/Volo/Abp/Check.cs | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs index d4361875ec..01ffc8c55b 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs @@ -163,18 +163,7 @@ public static class Check return value; } - public static T NotDefault( - T value, - [InvokerParameterName][NotNull] string parameterName) - where T : struct - { - if(value.Equals(default(T))) - { - throw new ArgumentException($"{parameterName} has a default value or is empty!", parameterName); - } - return value; - } public static Int16 Positive( Int16 value, @@ -319,6 +308,10 @@ public static class Check if (value < minimumValue || value > maximumValue) { throw new ArgumentException($"{parameterName} is out of range min: {minimumValue} - max: {maximumValue}"); + } + return value; + } + public static double Range( double value, @@ -349,4 +342,17 @@ public static class Check return value; } + public static T NotDefault( + T value, + [InvokerParameterName][NotNull] string parameterName) + where T : struct + { + if(value.Equals(default(T))) + { + throw new ArgumentException($"{parameterName} has a default value or is empty!", parameterName); + } + + return value; + } + } From a4bc569e155b1b65c92e6e74b6f26cbe33df336d Mon Sep 17 00:00:00 2001 From: j0nimost Date: Mon, 23 May 2022 10:39:53 +0300 Subject: [PATCH 3/8] Implemented a Null or Empty checker for structs --- framework/src/Volo.Abp.Core/Volo/Abp/Check.cs | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs index 01ffc8c55b..7758058e95 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs @@ -342,17 +342,28 @@ public static class Check return value; } - public static T NotDefault( - T value, - [InvokerParameterName][NotNull] string parameterName) + /// + /// Checks if value of type T (struct) is empty, default or null + /// + /// + /// + /// + /// + /// + public static T NotDefaultorNull( + Nullable value, + string parameterName) where T : struct - { - if(value.Equals(default(T))) + { + if (value.Equals(default(T))) { throw new ArgumentException($"{parameterName} has a default value or is empty!", parameterName); } - - return value; - } + else if (value.HasValue == false) + { + throw new ArgumentException($"{parameterName} is null!", parameterName); + } + return (T)value; + } } From d2a9d43ea46cc13fb5210b6f03f0c74a23a69a9e Mon Sep 17 00:00:00 2001 From: j0nimost Date: Mon, 23 May 2022 10:41:09 +0300 Subject: [PATCH 4/8] Added parameterName validation --- framework/src/Volo.Abp.Core/Volo/Abp/Check.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs index 7758058e95..c31d616518 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs @@ -352,7 +352,7 @@ public static class Check /// public static T NotDefaultorNull( Nullable value, - string parameterName) + [InvokerParameterName][NotNull] string parameterName) where T : struct { if (value.Equals(default(T))) From 20950b576e8623bc81d7f8caf1dbe27d10fdf377 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 27 May 2022 08:34:23 +0800 Subject: [PATCH 5/8] Update Check.cs --- framework/src/Volo.Abp.Core/Volo/Abp/Check.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs index c31d616518..8979c897a3 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs @@ -163,8 +163,6 @@ public static class Check return value; } - - public static Int16 Positive( Int16 value, [InvokerParameterName][NotNull] string parameterName) @@ -363,6 +361,7 @@ public static class Check { throw new ArgumentException($"{parameterName} is null!", parameterName); } + return (T)value; } From c3d9f94f7928b3a8e825821346e9ba2ac1ada4b0 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 27 May 2022 08:48:25 +0800 Subject: [PATCH 6/8] Update Check.cs --- framework/src/Volo.Abp.Core/Volo/Abp/Check.cs | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs index 8979c897a3..a2448190a5 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs @@ -253,8 +253,6 @@ public static class Check return value; } - - public static Int16 Range( Int16 value, [InvokerParameterName][NotNull] string parameterName, @@ -340,29 +338,21 @@ public static class Check return value; } - /// - /// Checks if value of type T (struct) is empty, default or null - /// - /// - /// - /// - /// - /// - public static T NotDefaultorNull( - Nullable value, + public static T NotDefaultOrNull( + T? value, [InvokerParameterName][NotNull] string parameterName) where T : struct { - if (value.Equals(default(T))) + if (value == null) { - throw new ArgumentException($"{parameterName} has a default value or is empty!", parameterName); + throw new ArgumentException($"{parameterName} is null!", parameterName); } - else if (value.HasValue == false) + + if (value.Value.Equals(default(T))) { - throw new ArgumentException($"{parameterName} is null!", parameterName); + throw new ArgumentException($"{parameterName} has a default value!", parameterName); } - return (T)value; + return value.Value; } - } From b0687639c0bc12122a134772f025fa3de1f4309b Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 27 May 2022 11:27:37 +0800 Subject: [PATCH 7/8] CLI Compatible `AuthServer` project name. --- ...onmentFilePortChangeForSeparatedAuthServersStep.cs} | 2 +- .../ProjectBuilding/Templates/App/AppTemplateBase.cs | 6 +++--- ...pTemplateChangeConsoleTestClientPortSettingsStep.cs | 10 +++++----- .../App/AppTemplateChangeDbMigratorPortSettingsStep.cs | 10 +++++----- ...ppTemplateSwitchEntityFrameworkCoreToMongoDbStep.cs | 9 +++++++++ ...ttingsFilePortChangeForSeparatedAuthServersStep.cs} | 2 +- ...onmentFilePortChangeForSeparatedAuthServersStep.cs} | 2 +- .../Templates/RemoveUnnecessaryPortsStep.cs | 4 ++-- .../Abp/Cli/ProjectModification/NuGetPackageTarget.cs | 2 +- .../Volo/Abp/Cli/ProjectModification/ProjectFinder.cs | 3 ++- .../ProjectModification/ProjectNugetPackageAdder.cs | 2 +- .../Abp/Cli/ProjectModification/SolutionModuleAdder.cs | 2 +- 12 files changed, 32 insertions(+), 22 deletions(-) rename framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/{AngularEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs => AngularEnvironmentFilePortChangeForSeparatedAuthServersStep.cs} (93%) rename framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/{BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep.cs => BlazorAppsettingsFilePortChangeForSeparatedAuthServersStep.cs} (92%) rename framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/{ReactEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs => ReactEnvironmentFilePortChangeForSeparatedAuthServersStep.cs} (91%) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AngularEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AngularEnvironmentFilePortChangeForSeparatedAuthServersStep.cs similarity index 93% rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AngularEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AngularEnvironmentFilePortChangeForSeparatedAuthServersStep.cs index e781accafe..c376397a3d 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AngularEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AngularEnvironmentFilePortChangeForSeparatedAuthServersStep.cs @@ -4,7 +4,7 @@ using Volo.Abp.Cli.ProjectBuilding.Building; namespace Volo.Abp.Cli.ProjectBuilding.Templates.App; -public class AngularEnvironmentFilePortChangeForSeparatedIdentityServersStep : ProjectBuildPipelineStep +public class AngularEnvironmentFilePortChangeForSeparatedAuthServersStep : ProjectBuildPipelineStep { public override void Execute(ProjectBuildContext context) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs index 0e268d6705..45a3a228d3 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs @@ -283,7 +283,7 @@ public abstract class AppTemplateBase : TemplateInfo context.BuildArgs.ExtraProperties.ContainsKey("separate-auth-server")) { steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds")); - steps.Add(new BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep()); + steps.Add(new BlazorAppsettingsFilePortChangeForSeparatedAuthServersStep()); steps.Add(new AppTemplateChangeDbMigratorPortSettingsStep("44300")); } else @@ -368,12 +368,12 @@ public abstract class AppTemplateBase : TemplateInfo context.BuildArgs.ExtraProperties.ContainsKey("separate-auth-server")) { steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds")); - steps.Add(new AngularEnvironmentFilePortChangeForSeparatedIdentityServersStep()); + steps.Add(new AngularEnvironmentFilePortChangeForSeparatedAuthServersStep()); steps.Add(new AppTemplateChangeDbMigratorPortSettingsStep("44300")); if (context.BuildArgs.MobileApp == MobileApp.ReactNative) { - steps.Add(new ReactEnvironmentFilePortChangeForSeparatedIdentityServersStep()); + steps.Add(new ReactEnvironmentFilePortChangeForSeparatedAuthServersStep()); } } else diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeConsoleTestClientPortSettingsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeConsoleTestClientPortSettingsStep.cs index 4eb9867117..b37736696f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeConsoleTestClientPortSettingsStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeConsoleTestClientPortSettingsStep.cs @@ -6,16 +6,16 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App; public class AppTemplateChangeConsoleTestClientPortSettingsStep : ProjectBuildPipelineStep { public string RemoteServicePort { get; } - public string IdentityServerPort { get; } + public string AuthServerPort { get; } /// - /// Assumed same as the if leaved as null. + /// Assumed same as the if leaved as null. public AppTemplateChangeConsoleTestClientPortSettingsStep( string remoteServicePort, - string identityServerPort = null) + string authServerPort = null) { RemoteServicePort = remoteServicePort; - IdentityServerPort = identityServerPort ?? remoteServicePort; + AuthServerPort = authServerPort ?? remoteServicePort; } public override void Execute(ProjectBuildContext context) @@ -23,6 +23,6 @@ public class AppTemplateChangeConsoleTestClientPortSettingsStep : ProjectBuildPi context .GetFile("/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/appsettings.json") .ReplaceText("44300", RemoteServicePort) - .ReplaceText("44301", IdentityServerPort); + .ReplaceText("44301", AuthServerPort); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeDbMigratorPortSettingsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeDbMigratorPortSettingsStep.cs index d8665c0d6d..81c4ad3304 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeDbMigratorPortSettingsStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateChangeDbMigratorPortSettingsStep.cs @@ -5,19 +5,19 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App; public class AppTemplateChangeDbMigratorPortSettingsStep : ProjectBuildPipelineStep { - public string IdentityServerPort { get; } + public string AuthServerPort { get; } - /// + /// public AppTemplateChangeDbMigratorPortSettingsStep( - string identityServerPort) + string authServerPort) { - IdentityServerPort = identityServerPort; + AuthServerPort = authServerPort; } public override void Execute(ProjectBuildContext context) { context .GetFile("/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/appsettings.json") - .ReplaceText("44305", IdentityServerPort); + .ReplaceText("44305", AuthServerPort); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateSwitchEntityFrameworkCoreToMongoDbStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateSwitchEntityFrameworkCoreToMongoDbStep.cs index 58e4e62225..0eadd103e7 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateSwitchEntityFrameworkCoreToMongoDbStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateSwitchEntityFrameworkCoreToMongoDbStep.cs @@ -55,6 +55,15 @@ public class AppTemplateSwitchEntityFrameworkCoreToMongoDbStep : ProjectBuildPip "MyProjectNameMongoDbModule" ); + ChangeNamespaceAndKeyword( + context, + "/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs", + "MyCompanyName.MyProjectName.EntityFrameworkCore", + "MyCompanyName.MyProjectName.MongoDB", + _hasDbMigrations ? "MyProjectNameEntityFrameworkCoreDbMigrationsModule" : "MyProjectNameEntityFrameworkCoreModule", + "MyProjectNameMongoDbModule" + ); + ChangeConnectionStringToMongoDb( context, "/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/appsettings.json" diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/BlazorAppsettingsFilePortChangeForSeparatedAuthServersStep.cs similarity index 92% rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep.cs rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/BlazorAppsettingsFilePortChangeForSeparatedAuthServersStep.cs index 0a89d41a45..8c96082a60 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/BlazorAppsettingsFilePortChangeForSeparatedAuthServersStep.cs @@ -4,7 +4,7 @@ using Volo.Abp.Cli.ProjectBuilding.Building; namespace Volo.Abp.Cli.ProjectBuilding.Templates.App; -public class BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep : ProjectBuildPipelineStep +public class BlazorAppsettingsFilePortChangeForSeparatedAuthServersStep : ProjectBuildPipelineStep { public override void Execute(ProjectBuildContext context) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/ReactEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/ReactEnvironmentFilePortChangeForSeparatedAuthServersStep.cs similarity index 91% rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/ReactEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/ReactEnvironmentFilePortChangeForSeparatedAuthServersStep.cs index d0ffe98e34..0750587401 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/ReactEnvironmentFilePortChangeForSeparatedIdentityServersStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/ReactEnvironmentFilePortChangeForSeparatedAuthServersStep.cs @@ -4,7 +4,7 @@ using Volo.Abp.Cli.ProjectBuilding.Building; namespace Volo.Abp.Cli.ProjectBuilding.Templates.App; -public class ReactEnvironmentFilePortChangeForSeparatedIdentityServersStep : ProjectBuildPipelineStep +public class ReactEnvironmentFilePortChangeForSeparatedAuthServersStep : ProjectBuildPipelineStep { public override void Execute(ProjectBuildContext context) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs index e34f41a7a5..e3bc11a7c9 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs @@ -58,8 +58,8 @@ public class RemoveUnnecessaryPortsStep : ProjectBuildPipelineStep f.Name.Contains("MyCompanyName.MyProjectName.DbMigrator") && f.Name.EndsWith("appsettings.json")); var appSettingsJsonObject = JObject.Parse(dbMigratorAppSettings.Content); - var identityServerJsonObject = (JObject)appSettingsJsonObject["IdentityServer"]; - var clientsJsonObject = (JObject)identityServerJsonObject["Clients"]; + var authServerJsonObject = (JObject)appSettingsJsonObject["IdentityServer"] ?? (JObject)appSettingsJsonObject["OpenIddict"]; + var clientsJsonObject = (JObject)authServerJsonObject["Clients"] ?? (JObject)authServerJsonObject["Applications"]; if (context.BuildArgs.UiFramework != UiFramework.Blazor) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NuGetPackageTarget.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NuGetPackageTarget.cs index 4d111cbf73..c9b2473bcb 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NuGetPackageTarget.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NuGetPackageTarget.cs @@ -14,7 +14,7 @@ public enum NuGetPackageTarget : byte MongoDB = 9, SignalR = 10, Blazor = 11, - IdentityServer = 12, + IdentityServer = 12, //todo: Rename to AuthServer BlazorServer = 13, BlazorWebAssembly = 14 } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs index f4adfd4cf0..fbd8cdb599 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs @@ -23,7 +23,8 @@ public static class ProjectFinder case NuGetPackageTarget.Web: return FindProjectEndsWith(projectFiles, assemblyNames, ".Web"); case NuGetPackageTarget.IdentityServer: - return FindProjectEndsWith(projectFiles, assemblyNames, ".IdentityServer"); + return FindProjectEndsWith(projectFiles, assemblyNames, ".IdentityServer") ?? + FindProjectEndsWith(projectFiles, assemblyNames, ".AuthServer"); case NuGetPackageTarget.EntityFrameworkCore: return FindProjectEndsWith(projectFiles, assemblyNames, ".EntityFrameworkCore"); case NuGetPackageTarget.MongoDB: diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs index 4ca0e646e8..165c915c3a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs @@ -396,6 +396,6 @@ public class ProjectNugetPackageAdder : ITransientDependency return projectFiles.Select(ProjectFileNameHelper.GetAssemblyNameFromProjectPath) .Any(p => p.EndsWith(".HttpApi.Host")) && projectFiles.Select(ProjectFileNameHelper.GetAssemblyNameFromProjectPath) - .Any(p => p.EndsWith(".IdentityServer")); + .Any(p => p.EndsWith(".IdentityServer") || p.EndsWith(".AuthServer")); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs index 2bfcad2d32..8aa17596a2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs @@ -804,6 +804,6 @@ public class SolutionModuleAdder : ITransientDependency return projectFiles.Select(ProjectFileNameHelper.GetAssemblyNameFromProjectPath) .Any(p => p.EndsWith(".HttpApi.Host")) && projectFiles.Select(ProjectFileNameHelper.GetAssemblyNameFromProjectPath) - .Any(p => p.EndsWith(".IdentityServer")); + .Any(p => p.EndsWith(".IdentityServer") || p.EndsWith(".AuthServer")); } } From 567bf782950537efea8bdcd6184820cc5d7930d7 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 27 May 2022 13:21:05 +0800 Subject: [PATCH 8/8] add ` --depth 0` paramter for `npm list` command. --- .../Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs index 3984f0ca08..56fa776904 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs @@ -253,7 +253,7 @@ public class InstallLibsService : IInstallLibsService, ITransientDependency private bool IsYarnAvailable() { - var output = CmdHelper.RunCmdAndGetOutput("npm list yarn -g").Trim(); + var output = CmdHelper.RunCmdAndGetOutput("npm list yarn -g --depth 0").Trim(); if (output.Contains("empty")) { return false;