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 c4942d04ab..d9621e5f91 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
@@ -107,6 +107,12 @@ namespace Volo.Abp.Cli.Commands
Logger.LogInformation("UI Framework: " + uiFramework);
}
+ var publicWebSite = uiFramework != UiFramework.None && commandLineArgs.Options.ContainsKey(Options.PublicWebSite.Long);
+ if (publicWebSite)
+ {
+ Logger.LogInformation("Public Web Site: yes");
+ }
+
var mobileApp = GetMobilePreference(commandLineArgs);
if (mobileApp != MobileApp.None)
{
@@ -168,6 +174,7 @@ namespace Volo.Abp.Cli.Commands
databaseManagementSystem,
uiFramework,
mobileApp,
+ publicWebSite,
gitHubAbpLocalRepositoryPath,
gitHubVoloLocalRepositoryPath,
templateSource,
@@ -489,6 +496,11 @@ namespace Volo.Abp.Cli.Commands
public const string Long = "mobile";
}
+ public static class PublicWebSite
+ {
+ public const string Long = "with-public-website";
+ }
+
public static class TemplateSource
{
public const string Short = "ts";
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs
index 28f41e55d8..6306619e56 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs
@@ -40,6 +40,7 @@ namespace Volo.Abp.Cli.Commands.Services
DatabaseManagementSystem.NotSpecified,
UiFramework.NotSpecified,
null,
+ false,
gitHubAbpLocalRepositoryPath,
gitHubVoloLocalRepositoryPath,
null,
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeDbMigratorPublicPortStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeDbMigratorPublicPortStep.cs
new file mode 100644
index 0000000000..72e05b74b0
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeDbMigratorPublicPortStep.cs
@@ -0,0 +1,15 @@
+using System.Linq;
+
+namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
+{
+ public class ChangeDbMigratorPublicPortStep: ProjectBuildPipelineStep
+ {
+ public override void Execute(ProjectBuildContext context)
+ {
+ var dbMigratorAppSettings = context.Files
+ .FirstOrDefault(f => f.Name.Contains("MyCompanyName.MyProjectName.DbMigrator") && f.Name.EndsWith("appsettings.json"));
+
+ dbMigratorAppSettings?.SetContent(dbMigratorAppSettings.Content.Replace("localhost:44304","localhost:44306"));
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangePublicAuthPortStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangePublicAuthPortStep.cs
new file mode 100644
index 0000000000..0d33b16309
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangePublicAuthPortStep.cs
@@ -0,0 +1,15 @@
+using System.Linq;
+
+namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
+{
+ public class ChangePublicAuthPortStep: ProjectBuildPipelineStep
+ {
+ public override void Execute(ProjectBuildContext context)
+ {
+ var publicAppSettings = context.Files
+ .FirstOrDefault(f => f.Name.Contains("MyCompanyName.MyProjectName.Web.Public") && f.Name.EndsWith("appsettings.json"));
+
+ publicAppSettings?.SetContent(publicAppSettings.Content.Replace("localhost:44303","localhost:44305"));
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs
new file mode 100644
index 0000000000..4f63d377ea
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs
@@ -0,0 +1,24 @@
+using System.Linq;
+using Volo.Abp.Cli.ProjectBuilding.Files;
+
+namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
+{
+ public class RemoveCmsKitStep : ProjectBuildPipelineStep
+ {
+ public override void Execute(ProjectBuildContext context)
+ {
+ var commonFiles = context.Files.Where(f =>
+ f.Name.EndsWith(".csproj") ||
+ f.Name.EndsWith("Module.cs") ||
+ f.Name.EndsWith("MyProjectNameMigrationsDbContext.cs") ||
+ f.Name.EndsWith("MyProjectNameGlobalFeatureConfigurator.cs") ||
+ (f.Name.EndsWith(".cshtml") && f.Name.Contains("MyCompanyName.MyProjectName.Web.Public"))
+ );
+
+ foreach (var file in commonFiles)
+ {
+ file.RemoveTemplateCodeIfNot("CMS-KIT");
+ }
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveEfCoreDependencyFromPublicStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveEfCoreDependencyFromPublicStep.cs
new file mode 100644
index 0000000000..f9e906c902
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveEfCoreDependencyFromPublicStep.cs
@@ -0,0 +1,14 @@
+using System.Linq;
+using Volo.Abp.Cli.ProjectBuilding.Files;
+
+namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
+{
+ public class RemoveEfCoreDependencyFromPublicStep : ProjectBuildPipelineStep
+ {
+ public override void Execute(ProjectBuildContext context)
+ {
+ context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.Web.Public.csproj"))?.RemoveTemplateCodeIfNot("EFCORE");
+ context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameWebPublicModule.cs"))?.RemoveTemplateCodeIfNot("EFCORE");
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveGlobalFeaturesPackageStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveGlobalFeaturesPackageStep.cs
new file mode 100644
index 0000000000..06fd565353
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveGlobalFeaturesPackageStep.cs
@@ -0,0 +1,14 @@
+using System.Linq;
+using Volo.Abp.Cli.ProjectBuilding.Files;
+
+namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
+{
+ public class RemoveGlobalFeaturesPackageStep : ProjectBuildPipelineStep
+ {
+ public override void Execute(ProjectBuildContext context)
+ {
+ context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.Domain.Shared.csproj"))?.RemoveTemplateCodeIf("CMS-KIT");
+ context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameDomainSharedModule.cs"))?.RemoveTemplateCodeIf("CMS-KIT");
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs
new file mode 100644
index 0000000000..94056cbf5a
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs
@@ -0,0 +1,17 @@
+using System.Linq;
+using Volo.Abp.Cli.ProjectBuilding.Files;
+
+namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
+{
+ public class RemovePublicRedisStep : ProjectBuildPipelineStep
+ {
+ public override void Execute(ProjectBuildContext context)
+ {
+ context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.Web.csproj"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS");
+ context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameWebModule.cs"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS");
+ context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS");
+ context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.HttpApi.Host.csproj"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS");
+ context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameHttpApiHostModule.cs"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS");
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs
index e673446d9f..8942103873 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/TemplateCodeDeleteStep.cs
@@ -8,7 +8,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
{
foreach (var file in context.Files)
{
- if (file.Name.EndsWith(".cs")) //TODO: Why only cs!
+ if (file.Name.EndsWith(".cs") || file.Name.EndsWith(".csproj") || file.Name.EndsWith(".cshtml"))
{
file.RemoveTemplateCode();
file.RemoveTemplateCodeMarkers();
@@ -16,4 +16,4 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
}
}
}
-}
\ No newline at end of file
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs
index 513c2b4198..31c8f216b4 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs
@@ -1,5 +1,4 @@
-using System;
-using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
+using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
using Volo.Abp.Cli.ProjectBuilding.Templates.App;
using Volo.Abp.Cli.ProjectBuilding.Templates.MvcModule;
@@ -28,13 +27,13 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building
if (context.Template.Name == AppProTemplate.TemplateName ||
context.Template.Name == ModuleProTemplate.TemplateName)
{
- pipeline.Steps.Add(new LicenseCodeReplaceStep());
+ pipeline.Steps.Add(new LicenseCodeReplaceStep()); // todo: move to custom steps?
}
if (context.Template.Name == AppTemplate.TemplateName ||
context.Template.Name == AppProTemplate.TemplateName)
{
- pipeline.Steps.Add(new DatabaseManagementSystemChangeStep());
+ pipeline.Steps.Add(new DatabaseManagementSystemChangeStep()); // todo: move to custom steps?
}
if ((context.BuildArgs.UiFramework == UiFramework.Mvc || context.BuildArgs.UiFramework == UiFramework.Blazor)
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs
index 900948ce9c..91180206bf 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs
@@ -15,7 +15,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Files
{
RemoveMarkedTemplateCode(file, "");
}
-
+
public static void RemoveTemplateCodeIf(this FileEntry file, string condition)
{
RemoveByCondition(file, "IF", condition);
@@ -68,7 +68,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Files
{
if (lines[i].Contains(beginMark))
{
- while (!lines[i].Contains("") && i < lines.Length)
+ while (i < lines.Length && !lines[i].Contains(""))
{
++i;
}
@@ -85,4 +85,4 @@ namespace Volo.Abp.Cli.ProjectBuilding.Files
file.SetLines(newLines);
}
}
-}
\ No newline at end of file
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs
index 1022f5f10e..71ccf96f7a 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs
@@ -23,6 +23,8 @@ namespace Volo.Abp.Cli.ProjectBuilding
public MobileApp? MobileApp { get; set; }
+ public bool PublicWebSite { get; set; }
+
[CanBeNull]
public string AbpGitHubLocalRepositoryPath { get; set; }
@@ -46,6 +48,7 @@ namespace Volo.Abp.Cli.ProjectBuilding
DatabaseManagementSystem databaseManagementSystem = DatabaseManagementSystem.NotSpecified,
UiFramework uiFramework = UiFramework.NotSpecified,
MobileApp? mobileApp = null,
+ bool publicWebSite = false,
[CanBeNull] string abpGitHubLocalRepositoryPath = null,
[CanBeNull] string voloGitHubLocalRepositoryPath = null,
[CanBeNull] string templateSource = null,
@@ -59,6 +62,7 @@ namespace Volo.Abp.Cli.ProjectBuilding
DatabaseManagementSystem = databaseManagementSystem;
UiFramework = uiFramework;
MobileApp = mobileApp;
+ PublicWebSite = publicWebSite;
AbpGitHubLocalRepositoryPath = abpGitHubLocalRepositoryPath;
VoloGitHubLocalRepositoryPath = voloGitHubLocalRepositoryPath;
TemplateSource = templateSource;
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 b5976b403f..27cfa0468b 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
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using Volo.Abp.Cli.Commands;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
@@ -24,11 +25,13 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App
SwitchDatabaseProvider(context, steps);
DeleteUnrelatedProjects(context, steps);
+ ConfigurePublicWebSite(context, steps);
RemoveUnnecessaryPorts(context, steps);
RandomizeSslPorts(context, steps);
RandomizeStringEncryption(context, steps);
UpdateNuGetConfig(context, steps);
CleanupFolderHierarchy(context, steps);
+ RemoveMigrations(context, steps);
return steps;
}
@@ -92,6 +95,62 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App
{
steps.Add(new RemoveFolderStep(MobileApp.ReactNative.GetFolderName().EnsureStartsWith('/')));
}
+
+ if (!context.BuildArgs.PublicWebSite)
+ {
+ steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public"));
+ steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public.Host"));
+ }
+ else
+ {
+ if (context.BuildArgs.ExtraProperties.ContainsKey(NewCommand.Options.Tiered.Long) || context.BuildArgs.ExtraProperties.ContainsKey("separate-identity-server"))
+ {
+ steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public"));
+ }
+ else
+ {
+ steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public.Host"));
+ }
+ }
+ }
+
+ private void ConfigurePublicWebSite(ProjectBuildContext context, List steps)
+ {
+ if (!context.BuildArgs.PublicWebSite)
+ {
+ if (!context.BuildArgs.ExtraProperties.ContainsKey(NewCommand.Options.Tiered.Long) &&
+ !context.BuildArgs.ExtraProperties.ContainsKey("separate-identity-server"))
+ {
+ steps.Add(new RemovePublicRedisStep());
+ }
+
+ steps.Add(new RemoveCmsKitStep());
+ return;
+ }
+
+ if (context.BuildArgs.ExtraProperties.ContainsKey(NewCommand.Options.Tiered.Long) || context.BuildArgs.ExtraProperties.ContainsKey("separate-identity-server"))
+ {
+ steps.Add(new AppTemplateProjectRenameStep("MyCompanyName.MyProjectName.Web.Public.Host","MyCompanyName.MyProjectName.Web.Public"));
+ steps.Add(new ChangeDbMigratorPublicPortStep());
+ }
+ else if (context.BuildArgs.UiFramework != UiFramework.NotSpecified && context.BuildArgs.UiFramework != UiFramework.Mvc)
+ {
+ steps.Add(new ChangePublicAuthPortStep());
+ }
+
+ if (context.BuildArgs.DatabaseProvider != DatabaseProvider.NotSpecified || context.BuildArgs.DatabaseProvider != DatabaseProvider.EntityFrameworkCore)
+ {
+ steps.Add(new RemoveEfCoreDependencyFromPublicStep());
+ }
+
+ if (context.BuildArgs.ExtraProperties.ContainsKey("without-cms-kit"))
+ {
+ steps.Add(new RemoveCmsKitStep());
+ }
+ else
+ {
+ steps.Add(new RemoveGlobalFeaturesPackageStep());
+ }
}
private static void ConfigureWithoutUi(ProjectBuildContext context, List steps)
@@ -216,6 +275,11 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App
steps.Add(new UpdateNuGetConfigStep("/aspnet-core/NuGet.Config"));
}
+ private static void RemoveMigrations(ProjectBuildContext context, List steps)
+ {
+ steps.Add(new RemoveFolderStep("/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations"));
+ }
+
private static void CleanupFolderHierarchy(ProjectBuildContext context, List steps)
{
if (context.BuildArgs.UiFramework == UiFramework.Mvc && context.BuildArgs.MobileApp == MobileApp.None)
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 4d44cf0b05..620fc5219e 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
@@ -4,12 +4,19 @@ using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Volo.Abp.Cli.ProjectBuilding.Building;
+using Volo.Abp.Cli.ProjectBuilding.Files;
namespace Volo.Abp.Cli.ProjectBuilding.Templates
{
public class RemoveUnnecessaryPortsStep : ProjectBuildPipelineStep
{
public override void Execute(ProjectBuildContext context)
+ {
+ RemoveUnnecessaryDbMigratorClients(context);
+ RemoveUnnecessaryHttpApiHostPorts(context);
+ }
+
+ private static void RemoveUnnecessaryHttpApiHostPorts(ProjectBuildContext context)
{
var httpApiHostAppSettings = context.Files.FirstOrDefault(f => f.Name.EndsWith(".HttpApi.Host/appsettings.json"));
@@ -28,6 +35,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates
appJson.Property("ClientUrl")?.Remove();
portsToRemoveFromCors.Add("4200");
}
+
if (context.BuildArgs.UiFramework != UiFramework.Blazor)
{
portsToRemoveFromCors.Add("44307");
@@ -36,11 +44,33 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates
if (appJson["CorsOrigins"] != null)
{
appJson["CorsOrigins"] = string.Join(",",
- appJson["CorsOrigins"].ToString().Split(",").Where(u=> !portsToRemoveFromCors.Any(u.EndsWith))
- );
+ appJson["CorsOrigins"].ToString().Split(",").Where(u => !portsToRemoveFromCors.Any(u.EndsWith))
+ );
}
httpApiHostAppSettings.SetContent(JsonConvert.SerializeObject(appSettingsJson, Formatting.Indented));
}
+
+ private static void RemoveUnnecessaryDbMigratorClients(ProjectBuildContext context)
+ {
+ var dbMigratorAppSettings = context.Files
+ .FirstOrDefault(f =>
+ 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"];
+
+ if (context.BuildArgs.UiFramework != UiFramework.Blazor)
+ {
+ clientsJsonObject.Remove("MyProjectName_Blazor");
+ }
+ if (!context.BuildArgs.PublicWebSite)
+ {
+ clientsJsonObject.Remove("MyProjectName_Web_Public");
+ }
+
+ dbMigratorAppSettings.SetContent(appSettingsJsonObject.ToString(Formatting.Indented));
+ }
}
}