mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-03 23:07:21 +00:00
Upgraded to MudBlazor 9 (#1137)
This commit is contained in:
1 parent
e0337a99bc
commit
aeba1fbccc
625 files changed
+408
-882
No files matched your search
@@ -8,6 +8,12 @@ namespace Build.Commands;
|
||||
|
||||
public sealed class UpdateWebAssetsCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// The pre-compressed copies and the source maps of the web assets. The app serves its web assets
|
||||
/// from the files embedded into it and uses neither, so they would only enlarge it.
|
||||
/// </summary>
|
||||
private static readonly HashSet<string> SKIPPED_EXTENSIONS = new(StringComparer.OrdinalIgnoreCase) { ".br", ".gz", ".map" };
|
||||
|
||||
[Command("update-web", Description = "Update web assets")]
|
||||
public void UpdateWebAssets()
|
||||
{
|
||||
@@ -29,26 +35,31 @@ public sealed class UpdateWebAssetsCommand
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// The destination also holds files of our own, such as the code editor. Hence, we replace
|
||||
// only the folder of each package, so that files a package no longer ships disappear:
|
||||
//
|
||||
var destinationPath = Path.Join(cwd, "wwwroot", "system");
|
||||
if(Directory.Exists(destinationPath))
|
||||
Directory.Delete(destinationPath, true);
|
||||
|
||||
Directory.CreateDirectory(destinationPath);
|
||||
|
||||
var sourcePaths = Directory.EnumerateFiles(contentPath, "*", SearchOption.AllDirectories);
|
||||
var counter = 0;
|
||||
foreach(var sourcePath in sourcePaths)
|
||||
foreach (var packagePath in Directory.EnumerateDirectories(contentPath))
|
||||
{
|
||||
counter++;
|
||||
var relativePath = sourcePath
|
||||
.Replace(contentPath, "")
|
||||
.TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||
var targetPath = Path.Join(cwd, "wwwroot", "system", relativePath);
|
||||
var targetDirectory = Path.GetDirectoryName(targetPath);
|
||||
if (targetDirectory != null)
|
||||
Directory.CreateDirectory(targetDirectory);
|
||||
|
||||
File.Copy(sourcePath, targetPath, true);
|
||||
var packageDestinationPath = Path.Join(destinationPath, Path.GetFileName(packagePath));
|
||||
if (Directory.Exists(packageDestinationPath))
|
||||
Directory.Delete(packageDestinationPath, true);
|
||||
|
||||
foreach (var sourcePath in Directory.EnumerateFiles(packagePath, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
if (SKIPPED_EXTENSIONS.Contains(Path.GetExtension(sourcePath)))
|
||||
continue;
|
||||
|
||||
counter++;
|
||||
var targetPath = Path.Join(packageDestinationPath, Path.GetRelativePath(packagePath, sourcePath));
|
||||
var targetDirectory = Path.GetDirectoryName(targetPath);
|
||||
if (targetDirectory != null)
|
||||
Directory.CreateDirectory(targetDirectory);
|
||||
|
||||
File.Copy(sourcePath, targetPath, true);
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine($" {counter:###,###} web assets updated successfully.");
|
||||
|
||||
Reference in new issue
Block a user