Browse Source

Allow to create with MAUI in ABP CLI

pull/13445/head
liangshiwei 4 years ago
parent
commit
15de3fc6b1
  1. 2
      docs/en/CLI-New-Command-Samples.md
  2. 1
      docs/en/CLI.md
  3. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs
  4. 5
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/MobileApp.cs
  5. 10
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs

2
docs/en/CLI-New-Command-Samples.md

@ -1,6 +1,6 @@
# ABP CLI - New Solution Sample Commands
The `abp new` command creates an ABP solution or other artifacts based on an ABP template. [ABP CLI](CLI.md) has several parameters to create a new ABP solution. In this document we will show you some sample commands to create a new solution. All the project names are `Acme.BookStore`. Currently, the only available mobile project is a `React Native` mobile app. Available database providers are `Entity Framework Core` and `MongoDB`. All the commands starts with `abp new`.
The `abp new` command creates an ABP solution or other artifacts based on an ABP template. [ABP CLI](CLI.md) has several parameters to create a new ABP solution. In this document we will show you some sample commands to create a new solution. All the project names are `Acme.BookStore`. Currently, the available mobile projects are `React Native` and `MAUI` mobile app. Available database providers are `Entity Framework Core` and `MongoDB`. All the commands starts with `abp new`.
## Angular

1
docs/en/CLI.md

@ -124,6 +124,7 @@ For more samples, go to [ABP CLI Create Solution Samples](CLI-New-Command-Sample
* `--separate-auth-server`: The Identity Server project comes as a separate project and runs at a different endpoint. It separates the Identity Server 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:
* `react-native`: React Native.
* `maui`: MAUI.
* `--database-provider` or `-d`: Specifies the database provider. Default provider is `ef`. Available providers:
* `ef`: Entity Framework Core.
* `mongodb`: MongoDB.

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs

@ -493,6 +493,8 @@ public abstract class ProjectCreationCommandBase
return MobileApp.None;
case "react-native":
return MobileApp.ReactNative;
case "maui":
return MobileApp.Maui;
default:
throw new CliUsageException(ExceptionMessageHelper.GetInvalidOptionExceptionMessage("Mobile App"));
}

5
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/MobileApp.cs

@ -7,7 +7,8 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building;
public enum MobileApp
{
None,
ReactNative
ReactNative,
Maui
}
public static class MobileAppExtensions
@ -18,6 +19,8 @@ public static class MobileAppExtensions
{
case MobileApp.ReactNative:
return "react-native";
case MobileApp.Maui:
return "MAUI";
}
throw new Exception("Mobile app folder name is not set!");

10
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs

@ -5,6 +5,7 @@ using NuGet.Versioning;
using Volo.Abp.Cli.Commands;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
using Volo.Abp.Cli.ProjectBuilding.Templates.Maui;
using Volo.Abp.Cli.ProjectBuilding.Templates.Microservice;
namespace Volo.Abp.Cli.ProjectBuilding.Templates.App;
@ -161,6 +162,15 @@ public abstract class AppTemplateBase : TemplateInfo
steps.Add(new RemoveFolderStep(MobileApp.ReactNative.GetFolderName().EnsureStartsWith('/')));
}
if (context.BuildArgs.MobileApp == MobileApp.Maui)
{
steps.Add(new MauiChangeApplicationIdGuidStep());
}
else
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Maui"));
}
if (!context.BuildArgs.PublicWebSite)
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public"));

Loading…
Cancel
Save