|
|
|
@ -14,10 +14,12 @@ using Volo.Abp.Cli.Commands.Services; |
|
|
|
using Volo.Abp.Cli.LIbs; |
|
|
|
using Volo.Abp.Cli.ProjectBuilding; |
|
|
|
using Volo.Abp.Cli.ProjectBuilding.Building; |
|
|
|
using Volo.Abp.Cli.ProjectBuilding.Events; |
|
|
|
using Volo.Abp.Cli.ProjectBuilding.Templates.App; |
|
|
|
using Volo.Abp.Cli.ProjectBuilding.Templates.Microservice; |
|
|
|
using Volo.Abp.Cli.ProjectBuilding.Templates.Module; |
|
|
|
using Volo.Abp.Cli.Utils; |
|
|
|
using Volo.Abp.EventBus.Local; |
|
|
|
|
|
|
|
namespace Volo.Abp.Cli.Commands; |
|
|
|
|
|
|
|
@ -29,6 +31,7 @@ public abstract class ProjectCreationCommandBase |
|
|
|
public IInstallLibsService InstallLibsService { get; } |
|
|
|
public AngularPwaSupportAdder AngularPwaSupportAdder { get; } |
|
|
|
public InitialMigrationCreator InitialMigrationCreator { get; } |
|
|
|
public ILocalEventBus EventBus { get; } |
|
|
|
public ILogger<NewCommand> Logger { get; set; } |
|
|
|
|
|
|
|
public ThemePackageAdder ThemePackageAdder { get; } |
|
|
|
@ -40,7 +43,8 @@ public abstract class ProjectCreationCommandBase |
|
|
|
IInstallLibsService installLibsService, |
|
|
|
AngularPwaSupportAdder angularPwaSupportAdder, |
|
|
|
InitialMigrationCreator initialMigrationCreator, |
|
|
|
ThemePackageAdder themePackageAdder) |
|
|
|
ThemePackageAdder themePackageAdder, |
|
|
|
ILocalEventBus eventBus) |
|
|
|
{ |
|
|
|
ConnectionStringProvider = connectionStringProvider; |
|
|
|
SolutionPackageVersionFinder = solutionPackageVersionFinder; |
|
|
|
@ -48,6 +52,7 @@ public abstract class ProjectCreationCommandBase |
|
|
|
InstallLibsService = installLibsService; |
|
|
|
AngularPwaSupportAdder = angularPwaSupportAdder; |
|
|
|
InitialMigrationCreator = initialMigrationCreator; |
|
|
|
EventBus = eventBus; |
|
|
|
ThemePackageAdder = themePackageAdder; |
|
|
|
|
|
|
|
Logger = NullLogger<NewCommand>.Instance; |
|
|
|
@ -201,6 +206,10 @@ public abstract class ProjectCreationCommandBase |
|
|
|
|
|
|
|
protected void ExtractProjectZip(ProjectBuildResult project, string outputFolder) |
|
|
|
{ |
|
|
|
EventBus.PublishAsync(new ProjectCreationProgressEvent { |
|
|
|
Message = "Extracting solution to file system" |
|
|
|
}, false); |
|
|
|
|
|
|
|
using (var templateFileStream = new MemoryStream(project.ZipContent)) |
|
|
|
{ |
|
|
|
using (var zipInputStream = new ZipInputStream(templateFileStream)) |
|
|
|
@ -332,10 +341,14 @@ public abstract class ProjectCreationCommandBase |
|
|
|
throw new CliUsageException("The option you provided for Database Provider is invalid!"); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void RunGraphBuildForMicroserviceServiceTemplate(ProjectBuildArgs projectArgs) |
|
|
|
protected virtual async Task RunGraphBuildForMicroserviceServiceTemplate(ProjectBuildArgs projectArgs) |
|
|
|
{ |
|
|
|
if (MicroserviceServiceTemplateBase.IsMicroserviceServiceTemplate(projectArgs.TemplateName)) |
|
|
|
{ |
|
|
|
await EventBus.PublishAsync(new ProjectCreationProgressEvent { |
|
|
|
Message = "Building the microservice solution" |
|
|
|
}, false); |
|
|
|
|
|
|
|
CmdHelper.RunCmd("dotnet build /graphbuild", projectArgs.OutputFolder); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -348,6 +361,11 @@ public abstract class ProjectCreationCommandBase |
|
|
|
MicroserviceServiceTemplateBase.IsMicroserviceTemplate(projectArgs.TemplateName)) |
|
|
|
{ |
|
|
|
Logger.LogInformation("Installing client-side packages..."); |
|
|
|
|
|
|
|
await EventBus.PublishAsync(new ProjectCreationProgressEvent { |
|
|
|
Message = "Installing client-side packages" |
|
|
|
}, false); |
|
|
|
|
|
|
|
await InstallLibsService.InstallLibsAsync(projectArgs.OutputFolder); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -384,10 +402,14 @@ public abstract class ProjectCreationCommandBase |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
await EventBus.PublishAsync(new ProjectCreationProgressEvent { |
|
|
|
Message = "Creating the initial migration" |
|
|
|
}, false); |
|
|
|
|
|
|
|
await InitialMigrationCreator.CreateAsync(Path.GetDirectoryName(efCoreProjectPath), isLayeredTemplate); |
|
|
|
} |
|
|
|
|
|
|
|
protected void ConfigurePwaSupportForAngular(ProjectBuildArgs projectArgs) |
|
|
|
protected async Task ConfigurePwaSupportForAngular(ProjectBuildArgs projectArgs) |
|
|
|
{ |
|
|
|
var isAngular = projectArgs.UiFramework == UiFramework.Angular; |
|
|
|
var isPwa = projectArgs.Pwa; |
|
|
|
@ -395,6 +417,7 @@ public abstract class ProjectCreationCommandBase |
|
|
|
if (isAngular && isPwa) |
|
|
|
{ |
|
|
|
Logger.LogInformation("Adding PWA Support to Angular app."); |
|
|
|
|
|
|
|
AngularPwaSupportAdder.AddPwaSupport(projectArgs.OutputFolder); |
|
|
|
} |
|
|
|
} |
|
|
|
|