Browse Source

cli add-module: DeleteAngularDirectoriesInModulesFolder if project is not angular

pull/3493/head
Yunus Emre Kalkan 7 years ago
parent
commit
0213990c91
  1. 19
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

19
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

@ -87,24 +87,39 @@ namespace Volo.Abp.Cli.ProjectModification
await SolutionFileModifier.AddModuleToSolutionFileAsync(module, solutionFile);
await NugetPackageToLocalReferenceConverter.Convert(module, solutionFile);
await HandleAngularProject(module, solutionFile);
await HandleAngularProject(modulesFolderInSolution, solutionFile);
}
ModifyDbContext(projectFiles, module, startupProject, skipDbMigrations);
}
private async Task HandleAngularProject(ModuleWithMastersInfo module, string solutionFilePath)
private async Task HandleAngularProject(string modulesFolderInSolution, string solutionFilePath)
{
var angularPath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(solutionFilePath)), "angular");
if (!Directory.Exists(angularPath))
{
DeleteAngularDirectoriesInModulesFolder(modulesFolderInSolution);
return;
}
await AngularModuleSourceCodeAdder.AddAsync(solutionFilePath, angularPath);
}
private static void DeleteAngularDirectoriesInModulesFolder(string modulesFolderInSolution)
{
var moduleFolders = Directory.GetDirectories(modulesFolderInSolution);
foreach (var moduleFolder in moduleFolders)
{
var angDir = Path.Combine(moduleFolder, "angular");
if (Directory.Exists(angDir))
{
Directory.Delete(angDir, true);
}
}
}
private async Task DownloadSourceCodesToSolutionFolder(ModuleWithMastersInfo module, string modulesFolderInSolution, string version = null)
{
var targetModuleFolder = Path.Combine(modulesFolderInSolution, module.Name);

Loading…
Cancel
Save