diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularModuleSourceCodeAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularModuleSourceCodeAdder.cs index d8f8404c46..c9812b7bf4 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularModuleSourceCodeAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularModuleSourceCodeAdder.cs @@ -1,7 +1,10 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Volo.Abp.DependencyInjection; @@ -10,24 +13,38 @@ namespace Volo.Abp.Cli.ProjectModification { public class AngularModuleSourceCodeAdder : ITransientDependency { + public ILogger Logger { get; set; } + + public AngularModuleSourceCodeAdder() + { + Logger = NullLogger.Instance; + } + public async Task AddAsync(string solutionFilePath, string angularPath) { - var angularProjectsPath = Path.Combine(angularPath, "projects"); + try + { + var angularProjectsPath = Path.Combine(angularPath, "projects"); - var projects = await CopyAndGetNamesOfAngularProjectsAsync(solutionFilePath, angularProjectsPath); + var projects = await CopyAndGetNamesOfAngularProjectsAsync(solutionFilePath, angularProjectsPath); - if (!projects.Any()) - { - return; - } + if (!projects.Any()) + { + return; + } - await ReplaceProjectNamesAndCopySourCodeRequirementsToProjectsAsync(angularProjectsPath, projects); + await ReplaceProjectNamesAndCopySourCodeRequirementsToProjectsAsync(angularProjectsPath, projects); - await RemoveRedundantFilesAsync(angularProjectsPath, projects); + await RemoveRedundantFilesAsync(angularProjectsPath, projects); - await AddPathsToTsConfigAsync(angularPath, angularProjectsPath, projects); + await AddPathsToTsConfigAsync(angularPath, angularProjectsPath, projects); - await AddProjectToAngularJsonAsync(angularPath, projects); + await AddProjectToAngularJsonAsync(angularPath, projects); + } + catch (Exception e) + { + Logger.LogError( "Unable to add angular source code: " + e.Message); + } } private async Task AddProjectToAngularJsonAsync(string angularPath, List projects)