Browse Source

repair build docs

IXLLEGACYIXL 2 years ago
parent
commit
edf481f9b1
1 changed files with 15 additions and 6 deletions
  1. 15 6
      BuildDocs.ps1

+ 15 - 6
BuildDocs.ps1

@@ -83,21 +83,24 @@ function Ask-IncludeAPI {
     Write-Host ""
     Write-Host -ForegroundColor Cyan "Do you want to include API?"
     Write-Host ""
-    Write-Host -ForegroundColor Yellow "  [Y] Yes"
+    Write-Host -ForegroundColor Yellow "  [Y] Yes or ENTER"
     Write-Host -ForegroundColor Yellow "  [N] No"
     Write-Host ""
 
-    return (Read-Host -Prompt "Your choice (Y/N)").ToLower() -eq "y"
+    $input = Read-Host -Prompt "Your choice [Y, N, or ENTER (default is Y)]"
+
+    return ($input -eq "Y" -or $input -eq "y" -or $input -eq "")
 }
 
 function Ask-UseExistingAPI {
     Write-Host ""
     Write-Host -ForegroundColor Cyan "Do you want to use already generated API metadata?"
     Write-Host ""
-    Write-Host -ForegroundColor Yellow "  [Y] Yes"
+    Write-Host -ForegroundColor Yellow "  [Y] Yes or ENTER"
     Write-Host -ForegroundColor Yellow "  [N] No"
     Write-Host ""
 
+    $input = Read-Host -Prompt "Your choice [Y, N, or ENTER (default is Y)]"
     return (Read-Host -Prompt "Your choice (Y/N)").ToLower() -eq "y"
 }
 
@@ -446,10 +449,16 @@ else {
     {
         $API = Ask-IncludeAPI
 
-        if ($API) {
-            $ReuseAPI = Ask-UseExistingAPI
-        }
+        if ($API)
+        {
+            # Check for .yml files
+            $ymlFiles = Get-ChildItem -Path "en/api/" -Filter "*.yml"
 
+            if ($ymlFiles.Count -gt 0)
+            {
+                $ReuseAPI = Ask-UseExistingAPI
+            }
+        }
     } elseif ($isCanceled) {
         Write-Host -ForegroundColor Red "Operation canceled by user."
         Stop-Transcript