Browse Source

Update AngularModuleSourceCodeAdder.cs

pull/6159/head
Yunus Emre Kalkan 6 years ago
parent
commit
7be76b4881
  1. 39
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AngularModuleSourceCodeAdder.cs

39
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.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -10,24 +13,38 @@ namespace Volo.Abp.Cli.ProjectModification
{ {
public class AngularModuleSourceCodeAdder : ITransientDependency public class AngularModuleSourceCodeAdder : ITransientDependency
{ {
public ILogger<SolutionModuleAdder> Logger { get; set; }
public AngularModuleSourceCodeAdder()
{
Logger = NullLogger<SolutionModuleAdder>.Instance;
}
public async Task AddAsync(string solutionFilePath, string angularPath) 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()) if (!projects.Any())
{ {
return; 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<string> projects) private async Task AddProjectToAngularJsonAsync(string angularPath, List<string> projects)

Loading…
Cancel
Save