/ src / modules / cmdpal / check-extensions.ps1
check-extensions.ps1
 1  # Use me to check if extensions deployed correctly
 2  
 3  $gitRoot = git rev-parse --show-toplevel
 4  Write-output "Checking repo root at $gitroot"
 5  $extensionsRoot = "$gitroot\x64\Debug\WinUI3Apps\CmdPalExtensions"
 6  Get-ChildItem -Path $extensionsRoot | ForEach-Object {
 7      $extensionName = $_.Name
 8      Write-Host "`e[1m$extensionName`e[m"
 9      $extensionName
10      $extensionAppx = $_.PsPath + "\Appx"
11      if ((Test-Path $extensionAppx) -eq $false) {
12          Write-Host "  `e[31;1mUNEXPECTED`e[0m: There was no Appx/ directory. Make sure you deploy the package!"
13      }
14      else
15      {
16          # Write-Host "`e[90m  Found Appx/ directory`e[0m"
17          $appxWinmd = $extensionAppx + "\Microsoft.CommandPalette.Extensions.winmd"
18          if ((Test-Path $appxWinmd) -eq $false) {
19              Write-Host "  `e[31;1mUNEXPECTED`e[0m: Did not find Microsoft.CommandPalette.Extensions.winmd"
20          }
21          else {
22              # Write-Host "`e[90m  Found the winmd`e[0m"
23              Write-Host "`e[92m  Everything looks good`e[0m"
24          }
25      }
26  }
27  
28  Write-Host "`e[1mChecking host apps:`e[m"
29  $hostAppxRoot = "$gitroot/x64/Debug/WinUI3Apps/CmdPal"
30  $hostAppxWinmd = $hostAppxRoot + "/Microsoft.CommandPalette.Extensions.winmd"
31  $prototypeAppxRoot = "$gitroot/x64/Debug/WinUI3Apps/CmdPal.Poc"
32  $prototypeAppxWinmd = $hostAppxRoot + "/Microsoft.CommandPalette.Extensions.winmd"
33  if ((Test-Path $hostAppxWinmd)) {
34      Write-Host "  Found Microsoft.CommandPalette.Extensions.winmd in The Real App's Appx/"
35  }
36  else {
37      Write-Host "  `e[31;1mUNEXPECTED`e[0m: Did not find Microsoft.CommandPalette.Extensions.winmd in The Real App's Appx/"
38      Write-Host "    Go look in: "
39      Write-Host "    start file://$hostAppxRoot"
40  }
41  if ((Test-Path $prototypeAppxWinmd)) {
42      Write-Host "  Found Microsoft.CommandPalette.Extensions.winmd in the prototype's Appx/"
43  }
44  else {
45      Write-Host "  `e[31;1mUNEXPECTED`e[0m: Did not find Microsoft.CommandPalette.Extensions.winmd in the prototype's Appx/"
46      Write-Host "    Go look in: "
47      Write-Host "    start file://$prototypeAppxRoot"
48  }
49  
50  Write-Host "`e[1mChecking actual extension interface project output:`e[m"
51  
52  $winmdRoot = "$gitroot/x64/Debug/Microsoft.CommandPalette.Extensions"
53  $winmdOutput = "$winmdRoot/Microsoft.CommandPalette.Extensions.winmd"
54  
55  if ((Test-Path $winmdOutput)) {
56      Write-Host "  Found Microsoft.CommandPalette.Extensions.winmd where it's built"
57  }
58  else {
59      Write-Host "  `e[31;1mUNEXPECTED`e[0m: Did not find Microsoft.CommandPalette.Extensions.winmd where it's supposed to be built! Did you build Microsoft.CommandPalette.Extensions?"
60      Write-Host "  Go look in: "
61      Write-Host "  start file://$winmdRoot"
62  }