From 17e3cebd490994dc94d0cf6a3911efa9925e41b8 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 20 Jun 2022 10:28:20 +0300 Subject: [PATCH 1/3] Cli: Don't allow company name in ms-service generation --- .../Commands/ProjectCreationCommandBase.cs | 38 ++++++++++++++++--- .../Abp/Cli/ProjectBuilding/SolutionName.cs | 2 + 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs index 6e280d7dc3..e672c763ae 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs @@ -129,18 +129,38 @@ public abstract class ProjectCreationCommandBase SolutionName solutionName; if (MicroserviceServiceTemplateBase.IsMicroserviceServiceTemplate(template)) { - var slnFile = Directory.GetFiles(outputFolderRoot, "*.sln").FirstOrDefault(); + var slnPath = commandLineArgs.Options.GetOrNull(Options.MainSolution.Short, Options.MainSolution.Long); - if (slnFile == null) + if (slnPath == null) { - throw new CliUsageException("This command should be run inside a folder that contains a microservice solution!"); + slnPath = Directory.GetFiles(outputFolderRoot, "*.sln").FirstOrDefault(); + } + else if (slnPath.EndsWith(".sln")) + { + Directory.SetCurrentDirectory(Path.GetDirectoryName(slnPath)); + outputFolderRoot = Path.GetDirectoryName(slnPath); + } + else if (!Directory.Exists(slnPath)) + { + slnPath = null; + } + else + { + Directory.SetCurrentDirectory(slnPath); + outputFolderRoot = slnPath; + slnPath = Directory.GetFiles(outputFolderRoot, "*.sln").FirstOrDefault(); + } + + if (slnPath == null) + { + throw new CliUsageException($"This command should be run inside a folder that contains a microservice solution! Or use -{Options.MainSolution.Short} parameter."); } - var microserviceSolutionName = Path.GetFileName(slnFile).RemovePostFix(".sln"); + var microserviceSolutionName = Path.GetFileName(slnPath).RemovePostFix(".sln"); - version ??= SolutionPackageVersionFinder.Find(slnFile); + version ??= SolutionPackageVersionFinder.Find(slnPath); solutionName = SolutionName.Parse(microserviceSolutionName, projectName); - outputFolder = MicroserviceServiceTemplateBase.CalculateTargetFolder(outputFolderRoot, projectName); + outputFolder = MicroserviceServiceTemplateBase.CalculateTargetFolder(outputFolderRoot, solutionName.ProjectName); uiFramework = uiFramework == UiFramework.NotSpecified ? FindMicroserviceSolutionUiFramework(outputFolderRoot) : uiFramework; } else @@ -512,5 +532,11 @@ public abstract class ProjectCreationCommandBase { public const string Short = "pwa"; } + + public static class MainSolution + { + public const string Short = "ms"; + public const string Long = "main-solution"; + } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/SolutionName.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/SolutionName.cs index 784fca27ad..13f759c851 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/SolutionName.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/SolutionName.cs @@ -19,6 +19,8 @@ public class SolutionName public static SolutionName Parse(string fullName, string microserviceName) { + microserviceName = microserviceName.Replace(".", string.Empty); + return new SolutionName(fullName + "." + microserviceName, fullName, microserviceName); } From c99af59b9530d97c2ada7accc337272e787eeaa8 Mon Sep 17 00:00:00 2001 From: Engincan VESKE Date: Tue, 28 Jun 2022 17:30:04 +0300 Subject: [PATCH 2/3] Update leptonx-lite docs --- docs/en/Themes/LeptonXLite/{mvc.md => AspNetCore.md} | 0 docs/en/Themes/LeptonXLite/angular.md | 2 +- docs/en/Themes/LeptonXLite/blazor.md | 4 ++-- docs/en/UI/Blazor/Theming.md | 2 +- docs/en/docs-nav.json | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) rename docs/en/Themes/LeptonXLite/{mvc.md => AspNetCore.md} (100%) diff --git a/docs/en/Themes/LeptonXLite/mvc.md b/docs/en/Themes/LeptonXLite/AspNetCore.md similarity index 100% rename from docs/en/Themes/LeptonXLite/mvc.md rename to docs/en/Themes/LeptonXLite/AspNetCore.md diff --git a/docs/en/Themes/LeptonXLite/angular.md b/docs/en/Themes/LeptonXLite/angular.md index 6e4cbef317..f362a4d95e 100644 --- a/docs/en/Themes/LeptonXLite/angular.md +++ b/docs/en/Themes/LeptonXLite/angular.md @@ -79,4 +79,4 @@ To change the logos and brand color of `LeptonX`, simply add the following CSS t ### Server Side -In order to migrate to LeptonX on your server side projects (Host and/or IdentityServer projects), please follow the [Server Side Migration](mvc.md) document. +In order to migrate to LeptonX on your server side projects (Host and/or IdentityServer projects), please follow the [Server Side Migration](AspNetCore.md) document. diff --git a/docs/en/Themes/LeptonXLite/blazor.md b/docs/en/Themes/LeptonXLite/blazor.md index 6f28d74a95..8ed8d37237 100644 --- a/docs/en/Themes/LeptonXLite/blazor.md +++ b/docs/en/Themes/LeptonXLite/blazor.md @@ -16,7 +16,7 @@ LeptonX Lite has implementation for the ABP Framework Blazor WebAssembly & Blazo ## Installation {{if UI == "Blazor"}} -- Complete the [MVC Razor Pages Installation](mvc.md#installation) for the **HttpApi.Host** application first. _If the solution is tiered/micro-service, complete the MVC steps for all MVC applications such as **HttpApi.Host** and if identity server is separated, install to the **IdentityServer**_. +- Complete the [MVC Razor Pages Installation](AspNetCore.md#installation) for the **HttpApi.Host** application first. _If the solution is tiered/micro-service, complete the MVC steps for all MVC applications such as **HttpApi.Host** and if identity server is separated, install to the **IdentityServer**_. - Add **Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme** package to your **Blazor WebAssembly** application with the following command: @@ -52,7 +52,7 @@ builder.RootComponents.Add("#ApplicationContainer"); {{if UI == "BlazorServer"}} -- Complete the [MVC Razor Pages Installation](mvc.md#installation) first. _If the solution is tiered/micro-service, complete the MVC steps for all MVC applications such as **HttpApi.Host** and **IdentityServer**_. +- Complete the [MVC Razor Pages Installation](AspNetCore.md#installation) first. _If the solution is tiered/micro-service, complete the MVC steps for all MVC applications such as **HttpApi.Host** and **IdentityServer**_. - Add **Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme** package to your **Blazor server** application with the following command: diff --git a/docs/en/UI/Blazor/Theming.md b/docs/en/UI/Blazor/Theming.md index c7f92189de..d8cec07cb3 100644 --- a/docs/en/UI/Blazor/Theming.md +++ b/docs/en/UI/Blazor/Theming.md @@ -27,7 +27,7 @@ Currently, three themes are **officially provided**: * The [Basic Theme](Basic-Theme.md) is the minimalist theme with the plain Bootstrap style. It is **open source and free**. * The [Lepton Theme](https://commercial.abp.io/themes) is a **commercial** theme developed by the core ABP team and is a part of the [ABP Commercial](https://commercial.abp.io/) license. -* The [LeptonX Theme](https://x.leptontheme.com/) is a theme that has a [commercial](https://docs.abp.io/en/commercial/latest/themes/lepton-x/commercial/blazor) and a [lite](../../Themes/LeptonXLite/blazor.md) version. +* The [LeptonX Theme](https://x.leptontheme.com/) is a theme that has a [commercial](https://docs.abp.io/en/commercial/latest/themes/lepton-x/commercial/blazor) and a [lite](../../Themes/LeptonXLite/Blazor.md) version. ## Overall diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index fe1033b305..3706f9289e 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -721,7 +721,7 @@ }, { "text": "LeptonX Lite", - "path": "Themes/LeptonXLite/mvc.md" + "path": "Themes/LeptonXLite/AspNetCore.md" } ] }, @@ -837,7 +837,7 @@ }, { "text": "LeptonX Lite", - "path": "Themes/LeptonXLite/blazor.md" + "path": "Themes/LeptonXLite/Blazor.md" }, { "text": "Branding", @@ -1104,7 +1104,7 @@ }, { "text": "LeptonX Lite", - "path": "Themes/LeptonXLite/angular.md" + "path": "Themes/LeptonXLite/Angular.md" } ] }, From ae71fd269f41d4444807ec56b2d8292af2d93372 Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 28 Jun 2022 17:50:29 +0300 Subject: [PATCH 3/3] Fix mistaken merge conflict merge --- .../Commands/ProjectCreationCommandBase.cs | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs index f0a85aeb53..7090853734 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs @@ -44,7 +44,7 @@ public abstract class ProjectCreationCommandBase AngularPwaSupportAdder angularPwaSupportAdder, InitialMigrationCreator initialMigrationCreator, ThemePackageAdder themePackageAdder, - ILocalEventBus eventBus) + ILocalEventBus eventBus) { ConnectionStringProvider = connectionStringProvider; SolutionPackageVersionFinder = solutionPackageVersionFinder; @@ -170,7 +170,7 @@ public abstract class ProjectCreationCommandBase outputFolderRoot = slnPath; slnPath = Directory.GetFiles(outputFolderRoot, "*.sln").FirstOrDefault(); } - + if (slnPath == null) { throw new CliUsageException($"This command should be run inside a folder that contains a microservice solution! Or use -{Options.MainSolution.Short} parameter."); @@ -227,10 +227,11 @@ public abstract class ProjectCreationCommandBase protected void ExtractProjectZip(ProjectBuildResult project, string outputFolder) { - EventBus.PublishAsync(new ProjectCreationProgressEvent { + EventBus.PublishAsync(new ProjectCreationProgressEvent + { Message = "Extracting the solution archieve" }, false); - + using (var templateFileStream = new MemoryStream(project.ZipContent)) { using (var zipInputStream = new ZipInputStream(templateFileStream)) @@ -366,10 +367,11 @@ public abstract class ProjectCreationCommandBase { if (MicroserviceServiceTemplateBase.IsMicroserviceServiceTemplate(projectArgs.TemplateName)) { - await EventBus.PublishAsync(new ProjectCreationProgressEvent { + await EventBus.PublishAsync(new ProjectCreationProgressEvent + { Message = "Building the microservice solution" }, false); - + CmdHelper.RunCmd("dotnet build /graphbuild", projectArgs.OutputFolder); } } @@ -382,11 +384,12 @@ public abstract class ProjectCreationCommandBase MicroserviceServiceTemplateBase.IsMicroserviceTemplate(projectArgs.TemplateName)) { Logger.LogInformation("Installing client-side packages..."); - - await EventBus.PublishAsync(new ProjectCreationProgressEvent { + + await EventBus.PublishAsync(new ProjectCreationProgressEvent + { Message = "Installing client-side packages" }, false); - + await InstallLibsService.InstallLibsAsync(projectArgs.OutputFolder); } } @@ -423,10 +426,11 @@ public abstract class ProjectCreationCommandBase return; } - await EventBus.PublishAsync(new ProjectCreationProgressEvent { + await EventBus.PublishAsync(new ProjectCreationProgressEvent + { Message = "Creating the initial DB migration" }, false); - + await InitialMigrationCreator.CreateAsync(Path.GetDirectoryName(efCoreProjectPath), isLayeredTemplate); } @@ -438,7 +442,7 @@ public abstract class ProjectCreationCommandBase if (isAngular && isPwa) { Logger.LogInformation("Adding PWA Support to Angular app."); - + AngularPwaSupportAdder.AddPwaSupport(projectArgs.OutputFolder); } } @@ -659,10 +663,11 @@ public abstract class ProjectCreationCommandBase { public const string Short = "ms"; public const string Long = "main-solution"; - + } + public static class Theme { public const string Long = "theme"; } } -} +} \ No newline at end of file