Skip to content

Instantly share code, notes, and snippets.

@ViktorHofer
Created March 11, 2024 14:51
Show Gist options
  • Save ViktorHofer/e4ba1766b7ee751261515781e7bb5927 to your computer and use it in GitHub Desktop.
Save ViktorHofer/e4ba1766b7ee751261515781e7bb5927 to your computer and use it in GitHub Desktop.
Create runtime package readme TODO table
foreach (string libDirectory in Directory.GetDirectories(@"C:\git\runtime2\src\libraries\"))
{
string libName = Path.GetFileName(libDirectory);
string srcLibDirectory = Path.Combine(libDirectory, "src");
if (Directory.Exists(srcLibDirectory))
{
string packageReadmeFile = Path.Combine(srcLibDirectory, "PACKAGE.md");
if (File.Exists(packageReadmeFile))
{
const string emptyPackageReadmeContent = """
<!-- The key features of this package -->
*
*
*
""";
if (File.ReadAllText(packageReadmeFile).Contains(emptyPackageReadmeContent))
{
Console.WriteLine(libName);
}
}
else
{
const string IsPackableMetadata = "true</IsPackable>";
string[] projectFiles = Directory.GetFiles(srcLibDirectory, "*.csproj", SearchOption.TopDirectoryOnly);
if (projectFiles.Length == 1 && File.ReadAllText(projectFiles[0]).Contains(IsPackableMetadata))
{
Console.WriteLine(libName);
}
else if (projectFiles.Length != 1)
{
Console.WriteLine("Weird lib folder: " + libName);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment