Merge pull request #5396 from abpframework/blazor-template-donwload

Blazor template download
pull/5408/head
Halil İbrahim Kalkan 5 years ago committed by GitHub
commit 8e9e4dd0c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -86,6 +86,8 @@ abp new Acme.BookStore
* `--tiered`: Creates a tiered solution where Web and Http API layers are physically separated. If not specified, it creates a layered solution which is less complex and suitable for most scenarios.
* `angular`: Angular. There are some additional options for this template:
* `--separate-identity-server`: Separates the identity server application from the API host application. If not specified, you will have a single endpoint in the server side.
* `blazor`: Blazor. There are some additional options for this template:
* `--separate-identity-server`: Separates the identity server application from the API host application. If not specified, you will have a single endpoint in the server side.
* `none`: Without UI. There are some additional options for this template:
* `--separate-identity-server`: Separates the identity server application from the API host application. If not specified, you will have a single endpoint in the server side.
* `--mobile` or `-m`: Specifies the mobile application framework. If not specified, no mobile application will be created. Available options:

@ -85,6 +85,8 @@ abp new Acme.BookStore
* `--tiered`: 创建分层解决方案,Web和Http Api层在物理上是分开的.如果未指定会创建一个分层的解决方案,此解决方案没有那么复杂,适合大多数场景.
* `angular`: Angular. 这个模板还有一些额外的选项:
* `--separate-identity-server`: 将Identity Server应用程序与API host应用程序分开. 如果未指定,则服务器端将只有一个端点.
* `blazor`: Blazor. 这个模板还有一些额外的选项:
* `--separate-identity-server`: 将Identity Server应用程序与API host应用程序分开. 如果未指定,则服务器端将只有一个端点.
* `none`: 无UI. 这个模板还有一些额外的选项:
* `--separate-identity-server`: 将Identity Server应用程序与API host应用程序分开. 如果未指定,则服务器端将只有一个端点.
* `--mobile` 或者 `-m`: 指定移动应用程序框架. 如果未指定,则不会创建任何移动应用程序,其他选项:

@ -286,6 +286,8 @@ namespace Volo.Abp.Cli.Commands
return UiFramework.Mvc;
case "angular":
return UiFramework.Angular;
case "blazor":
return UiFramework.Blazor;
default:
return UiFramework.NotSpecified;
}

@ -19,13 +19,14 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building
pipeline.Steps.Add(new TemplateCodeDeleteStep());
pipeline.Steps.Add(new SolutionRenameStep());
if (context.Template.Name == AppProTemplate.TemplateName ||
if (context.Template.Name == AppProTemplate.TemplateName ||
context.Template.Name == ModuleProTemplate.TemplateName)
{
pipeline.Steps.Add(new LicenseCodeReplaceStep());
}
if (context.BuildArgs.UiFramework == UiFramework.Mvc && context.BuildArgs.MobileApp == MobileApp.None)
if ((context.BuildArgs.UiFramework == UiFramework.Mvc || context.BuildArgs.UiFramework == UiFramework.Blazor)
&& context.BuildArgs.MobileApp == MobileApp.None)
{
pipeline.Steps.Add(new RemoveRootFolderStep());
}

@ -5,6 +5,7 @@
NotSpecified = 0,
None = 1,
Mvc = 2,
Angular = 3
Angular = 3,
Blazor = 4
}
}
}

@ -9,9 +9,10 @@
case UiFramework.None: return "none";
case UiFramework.Mvc: return "mvc";
case UiFramework.Angular: return "angular";
case UiFramework.Blazor: return "blazor";
case UiFramework.NotSpecified: return "NotSpecified";
default: return "NotSpecified";
}
}
}
}
}

@ -65,12 +65,22 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App
ConfigureWithAngularUi(context, steps);
break;
case UiFramework.Blazor:
ConfigureWithBlazorUi(context, steps);
break;
case UiFramework.Mvc:
case UiFramework.NotSpecified:
ConfigureWithMvcUi(context, steps);
break;
}
if (context.BuildArgs.UiFramework != UiFramework.Blazor)
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Blazor"));
}
if (context.BuildArgs.UiFramework != UiFramework.Angular)
{
steps.Add(new RemoveFolderStep("/angular"));
@ -101,6 +111,26 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App
}
}
private static void ConfigureWithBlazorUi(ProjectBuildContext context, List<ProjectBuildPipelineStep> steps)
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Host"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Tests", projectFolderPath: "/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests"));
if (context.BuildArgs.ExtraProperties.ContainsKey("separate-identity-server"))
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds"));
steps.Add(new BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep());
}
else
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.HttpApi.Host"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.IdentityServer"));
steps.Add(new AppTemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host"));
steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305"));
}
}
private static void ConfigureWithMvcUi(ProjectBuildContext context, List<ProjectBuildPipelineStep> steps)
{
if (context.BuildArgs.ExtraProperties.ContainsKey("tiered"))

@ -0,0 +1,39 @@
using System;
using System.Linq;
using Volo.Abp.Cli.ProjectBuilding.Building;
namespace Volo.Abp.Cli.ProjectBuilding.Templates.App
{
public class BlazorAppsettingsFilePortChangeForSeparatedIdentityServersStep : ProjectBuildPipelineStep
{
public override void Execute(ProjectBuildContext context)
{
var appsettingsFile = context.Files.FirstOrDefault(x =>
!x.IsDirectory &&
x.Name.EndsWith("aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/appsettings.json",
StringComparison.InvariantCultureIgnoreCase)
);
appsettingsFile.NormalizeLineEndings();
var lines = appsettingsFile.GetLines();
for (var i = 0; i < lines.Length; i++)
{
var line = lines[i];
if (line.Contains("Authority") && line.Contains("localhost"))
{
line = line.Replace("44305", "44301");
}
else if (line.Contains("BaseUrl") && line.Contains("localhost"))
{
line = line.Replace("44305", "44300");
}
lines[i] = line;
}
appsettingsFile.SetLines(lines);
}
}
}
Loading…
Cancel
Save