Browse Source

refactor document link

pull/9304/head
Alper Ebicoglu 5 years ago
parent
commit
e92c0c5d88
  1. 17
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ModuleInfo.cs
  2. 12
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

17
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ModuleInfo.cs

@ -1,4 +1,6 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Volo.Abp.Cli.ProjectModification
{
@ -15,5 +17,18 @@ namespace Volo.Abp.Cli.ProjectModification
public List<NugetPackageInfo> NugetPackages { get; set; }
public List<NpmPackageInfo> NpmPackages { get; set; }
public string GetFirstDocumentationLinkOrNull()
{
if (string.IsNullOrWhiteSpace(DocumentationLinks))
{
return null;
}
var docs = DocumentationLinks.Split(" ", StringSplitOptions.RemoveEmptyEntries);
return docs.Any() ?
docs.First() :
null;
}
}
}

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

@ -132,9 +132,11 @@ namespace Volo.Abp.Cli.ProjectModification
ModifyDbContext(projectFiles, module, skipDbMigrations);
if (!string.IsNullOrWhiteSpace(module.DocumentationLinks))
var documentationLink = module.GetFirstDocumentationLinkOrNull();
if (documentationLink != null)
{
CmdHelper.OpenWebPage(module.DocumentationLinks.Split(" ", StringSplitOptions.RemoveEmptyEntries)[0]);
CmdHelper.OpenWebPage(documentationLink);
}
}
@ -214,7 +216,7 @@ namespace Volo.Abp.Cli.ProjectModification
{
projectsToRemove.AddRange(await FindProjectsToRemoveByTarget(module, NuGetPackageTarget.BlazorWebAssembly, isProjectTiered));
webPackagesWillBeAddedToBlazorServerProject = module.NugetPackages.All(np=> np.Target != NuGetPackageTarget.BlazorServer && np.TieredTarget != NuGetPackageTarget.BlazorServer);
webPackagesWillBeAddedToBlazorServerProject = module.NugetPackages.All(np => np.Target != NuGetPackageTarget.BlazorServer && np.TieredTarget != NuGetPackageTarget.BlazorServer);
}
else
{
@ -255,7 +257,7 @@ namespace Volo.Abp.Cli.ProjectModification
private bool IsReferencedByAnotherModuleProject(string moduleDirectory, List<string> projectsToRemove, string projectToRemove)
{
var moduleProjects = Directory.GetFiles(moduleDirectory, "*.csproj", SearchOption.AllDirectories);
var projectsToKeep = moduleProjects.Where(mp=> !projectsToRemove.Contains(Path.GetFileName(mp).RemovePostFix(".csproj"))).ToList();
var projectsToKeep = moduleProjects.Where(mp => !projectsToRemove.Contains(Path.GetFileName(mp).RemovePostFix(".csproj"))).ToList();
return projectsToKeep.Select(File.ReadAllText).Any(content => content.Contains($"\"{projectToRemove}\""));
}
@ -283,7 +285,7 @@ namespace Volo.Abp.Cli.ProjectModification
return projectsToRemove;
}
private async Task<List<string>> FindProjectsToRemoveByPostFix(string moduleDirectory, string targetFolder,
private async Task<List<string>> FindProjectsToRemoveByPostFix(string moduleDirectory, string targetFolder,
string postFix)
{
var projectsToRemove = new List<string>();

Loading…
Cancel
Save