SHA256
CLI-Fixes: Help/Version vor Build, Content-Check, Default-Envs, Artefakte aus Git
- Program.cs: --help/--version werden vor Config-Laden und Directories.Init geprüft (verhindert Crashes außerhalb eines Site-Verzeichnisses) - Builder.cs: Pre-flight-Check ob content/ existiert; bei Fehlen klare Fehlermeldung + Exit 1 statt unhandled Exception. Build() gibt bool zurück, Program.cs setzt Environment.ExitCode. - BuildConfig.cs: Default-Environments von work/review/staging/deploy auf development/staging/deploy bereinigt (konsistent mit CLI-Aliasen) - .gitignore: build_log.txt/run_log.txt und webstatic.example/dist/ ignoriert; entsprechende Artefakte aus Git entfernt - tests/README.md: Platzhalter für künftige Test-Strategie - plans/01-offensichtliche-fixes.md: Fix-Plan dokumentiert
This commit is contained in:
+17
-1
@@ -7,8 +7,22 @@ namespace GCBoK.WebStaticBuilder;
|
||||
/// <summary>Main build orchestrator.</summary>
|
||||
public static class Builder
|
||||
{
|
||||
public static void Build(BuildConfig cfg, EnvironmentConfig env, string envName, bool verbose, bool dryRun)
|
||||
/// <returns><c>true</c> if the build completed; <c>false</c> if it was
|
||||
/// aborted due to a pre-flight check failure (missing content directory).</returns>
|
||||
public static bool Build(BuildConfig cfg, EnvironmentConfig env, string envName, bool verbose, bool dryRun)
|
||||
{
|
||||
// Pre-flight: content directory must exist — otherwise ContentLoader
|
||||
// throws an unhandled DirectoryNotFoundException. Fail gracefully with
|
||||
// an actionable message instead of a stack trace.
|
||||
if (!Directory.Exists(Directories.ContentDir))
|
||||
{
|
||||
Console.Error.WriteLine(
|
||||
$"ERROR: content directory not found: {Directories.ContentDir}");
|
||||
Console.Error.WriteLine(
|
||||
" Specify --root <dir> or --content <dir>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
File.WriteAllText(Directories.BuildLogPath,
|
||||
$"=== Build Started: {DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ===\n");
|
||||
File.AppendAllText(Directories.BuildLogPath,
|
||||
@@ -179,6 +193,8 @@ public static class Builder
|
||||
|
||||
if (cfg.Pagefind) BuildSearchIndex(verbose);
|
||||
else if (verbose) Console.WriteLine(" Pagefind disabled (config).");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static string LoadLayout()
|
||||
|
||||
Reference in New Issue
Block a user