Skip to content

Commit

Permalink
generate from zip
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatandrei committed Mar 10, 2024
1 parent 7f8efc2 commit f0d237e
Show file tree
Hide file tree
Showing 25 changed files with 141 additions and 221 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static async Task<int> Main(string[] args)
args = ["-h"];
args = new[] { "generateFiles",
"--folder", @"D:\gth\PackageAnalyzer\src\NetPackageAnalyzer\",
"--where", @"D:\gth\PackageAnalyzer\src\documentation\docs\Analysis",
"--where", @"D:\gth\PackageAnalyzer\src\documentation1\",
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static class GlobalsForGenerating
public static string prefixSite = "pathname:///docs/Analysis/";//for markdown
public static string NameSolution = "";
public static string Version { get; set; }=string.Empty;
public static string globalPrefix()
public static string globalPrefix()
{
return prefixSite + NameSolution;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace NetPackageAnalyzerDocusaurus;
using System.IO.Compression;

namespace NetPackageAnalyzerDocusaurus;

public class GenerateFilesDocusaurus:GenerateFiles
{
Expand All @@ -10,7 +12,15 @@ public GenerateFilesDocusaurus(IFileSystem system):base(system)
public override async Task GenerateNow(string folder, string where)
{

var folderResults = string.IsNullOrWhiteSpace(where) ? Path.Combine(folder, "Analysis") : where;
var folderResults = string.IsNullOrWhiteSpace(where) ? Path.Combine(folder, "Documentation") : where;
if(!Directory.Exists(folderResults))
Directory.CreateDirectory(folderResults);
var zip = Path.Combine(folderResults, "docusaurus.zip");
Console.WriteLine("generate docusaurus at" + zip);
await File.WriteAllBytesAsync(zip, MyResource.GetDocusaurusZip().ToArray());
ZipFile.ExtractToDirectory(zip, folderResults);


string generalSolution = $$"""
{
"label": "Solutions",
Expand All @@ -20,11 +30,12 @@ public override async Task GenerateNow(string folder, string where)
}
}
""";
folderResults = Path.Combine(folderResults, "docs");
var fileRoot = Path.Combine(folderResults, "_category_.json");
await File.WriteAllTextAsync(fileRoot, generalSolution);


folderResults = Path.Combine(folderResults, NameSolution);
folderResults = Path.Combine(folderResults,"Analysis", NameSolution);
WriteLine($"generate in {folderResults}");
if (!Directory.Exists(folderResults))
Directory.CreateDirectory(folderResults);
Expand Down
12 changes: 12 additions & 0 deletions src/NetPackageAnalyzer/NetPackageAnalyzerWork/MyResource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NetPackageAnalyzerDocusaurus;
internal partial class MyResource
{
[EmbedResourceCSharp.FileEmbed("docusaurus.zip")]
public static partial System.ReadOnlySpan<byte> GetDocusaurusZip();
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="EmbedResourceCSharp" Version="1.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup>
Expand All @@ -54,6 +58,7 @@
<Watch Include="**\*.cshtml" />
</ItemGroup>
<ItemGroup>
<None Remove="docusaurus.zip" />
<None Remove="Templates\BuildingBlocks.cshtml" />
<None Remove="Templates\DisplayAllVersionsProblemsForMarkdown.cshtml" />
<None Remove="Templates\ProjectPackages.cshtml" />
Expand All @@ -76,6 +81,9 @@
<Watch Remove="Templates\SimpleDisplayProjectWithReferencesProject.cshtml" />
<Watch Remove="Templates\TestProjects.cshtml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="docusaurus.zip" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NetPackageAnalyzerObjects\NetPackageAnalyzerObjects.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var nameCsproj = Model.NameCSproj();
var relativePath = Model.RelativePath();
var name = Model.FullNameMermaid();
var prefix = GlobalsForGenerating.globalPrefix();
}

# Project packages @relativePath
Expand All @@ -27,7 +28,7 @@
[Project References](ProjectReferences)


[Back To Solution](../../ProjectRelation)
[Back To Solution](@prefix/ProjectRelation)

<small>Generated by https://www.nuget.org/packages/NetPackageAnalyzerDocusaurus , version @GlobalsForGenerating.Version</small>

Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ click @nameCsproj "@prefix/Projects/@nameCsproj/ProjectReferences" "@relativePat
[Packages](Packages)


[Back To Solution](@prefix//ProjectRelation)
[Back To Solution](@prefix/ProjectRelation)

<small>Generated by https://www.nuget.org/packages/NetPackageAnalyzerDocusaurus , version @GlobalsForGenerating.Version</small>

Binary file not shown.
Loading

0 comments on commit f0d237e

Please sign in to comment.