Skip to content

Commit 95cd0aa

Browse files
authored
Fix PowerShell validation scripts for cross-platform support
1 parent c805391 commit 95cd0aa

9 files changed

Lines changed: 41 additions & 23 deletions

File tree

AI/mcp-server/validate-sample.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ param(
1010
Set-StrictMode -Version Latest
1111
$ErrorActionPreference = 'Stop'
1212

13-
. (Join-Path $PSScriptRoot '..\..\Tools\powershell\SampleValidation.ps1')
13+
. (Join-Path $PSScriptRoot '../../Tools/powershell/SampleValidation.ps1')
1414

1515
$appRoot = $PSScriptRoot
1616
$envFile = Join-Path $appRoot '.env'

AI/ocr/validate-sample.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ param(
1010
Set-StrictMode -Version Latest
1111
$ErrorActionPreference = 'Stop'
1212

13-
. (Join-Path $PSScriptRoot '..\..\Tools\powershell\SampleValidation.ps1')
13+
. (Join-Path $PSScriptRoot '../../Tools/powershell/SampleValidation.ps1')
1414

15-
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
16-
$toolRoot = Join-Path $repoRoot 'Tools\sample-validation'
15+
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
16+
$toolRoot = Join-Path $repoRoot 'Tools/sample-validation'
1717
$appRoot = $PSScriptRoot
1818
$envFile = Join-Path $appRoot '.env'
1919
$handles = @()

Custom Apps/boilerplate-aspnet-webservice/validate-sample.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ param(
1010
Set-StrictMode -Version Latest
1111
$ErrorActionPreference = 'Stop'
1212

13-
. (Join-Path $PSScriptRoot '..\..\Tools\powershell\SampleValidation.ps1')
13+
. (Join-Path $PSScriptRoot '../../Tools/powershell/SampleValidation.ps1')
1414

1515
$appRoot = $PSScriptRoot
1616
$appSettingsPath = Join-Path $appRoot 'appsettings.json'

Custom Apps/boilerplate-react-azurefunction/validate-sample.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ param(
1010
Set-StrictMode -Version Latest
1111
$ErrorActionPreference = 'Stop'
1212

13-
. (Join-Path $PSScriptRoot '..\..\Tools\powershell\SampleValidation.ps1')
13+
. (Join-Path $PSScriptRoot '../../Tools/powershell/SampleValidation.ps1')
1414

15-
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
16-
$toolRoot = Join-Path $repoRoot 'Tools\sample-validation'
15+
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
16+
$toolRoot = Join-Path $repoRoot 'Tools/sample-validation'
1717
$appRoot = $PSScriptRoot
18-
$clientRoot = Join-Path $appRoot 'packages\client-app'
19-
$functionsRoot = Join-Path $appRoot 'packages\azure-functions'
18+
$clientRoot = Join-Path $appRoot 'packages/client-app'
19+
$functionsRoot = Join-Path $appRoot 'packages/azure-functions'
2020
$clientEnvPath = Join-Path $clientRoot '.env'
2121
$localSettingsPath = Join-Path $functionsRoot 'local.settings.json'
2222
$handles = @()

Custom Apps/boilerplate-typescript-react/validate-sample.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ param(
1010
Set-StrictMode -Version Latest
1111
$ErrorActionPreference = 'Stop'
1212

13-
. (Join-Path $PSScriptRoot '..\..\Tools\powershell\SampleValidation.ps1')
13+
. (Join-Path $PSScriptRoot '../../Tools/powershell/SampleValidation.ps1')
1414

15-
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
16-
$toolRoot = Join-Path $repoRoot 'Tools\sample-validation'
15+
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
16+
$toolRoot = Join-Path $repoRoot 'Tools/sample-validation'
1717
$appRoot = $PSScriptRoot
1818
$functionApiRoot = Join-Path $appRoot 'function-api'
1919
$clientRoot = Join-Path $appRoot 'react-client'

Custom Apps/legal-docs/validate-sample.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ param(
1010
Set-StrictMode -Version Latest
1111
$ErrorActionPreference = 'Stop'
1212

13-
. (Join-Path $PSScriptRoot '..\..\Tools\powershell\SampleValidation.ps1')
13+
. (Join-Path $PSScriptRoot '../../Tools/powershell/SampleValidation.ps1')
1414

15-
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
16-
$toolRoot = Join-Path $repoRoot 'Tools\sample-validation'
15+
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
16+
$toolRoot = Join-Path $repoRoot 'Tools/sample-validation'
1717
$appRoot = $PSScriptRoot
1818
$runtimeHandle = $null
1919

Custom Apps/project-management/validate-sample.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ param(
1010
Set-StrictMode -Version Latest
1111
$ErrorActionPreference = 'Stop'
1212

13-
. (Join-Path $PSScriptRoot '..\..\Tools\powershell\SampleValidation.ps1')
13+
. (Join-Path $PSScriptRoot '../../Tools/powershell/SampleValidation.ps1')
1414

15-
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
16-
$toolRoot = Join-Path $repoRoot 'Tools\sample-validation'
15+
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
16+
$toolRoot = Join-Path $repoRoot 'Tools/sample-validation'
1717
$appRoot = $PSScriptRoot
1818
$runtimeHandle = $null
1919

Custom Apps/webhook/validate-sample.ps1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ param(
1010
Set-StrictMode -Version Latest
1111
$ErrorActionPreference = 'Stop'
1212

13-
. (Join-Path $PSScriptRoot '..\..\Tools\powershell\SampleValidation.ps1')
13+
. (Join-Path $PSScriptRoot '../../Tools/powershell/SampleValidation.ps1')
1414

1515
$appRoot = $PSScriptRoot
1616
$packageRoot = Join-Path $appRoot 'src'
@@ -44,7 +44,17 @@ try {
4444
}
4545

4646
try {
47-
$response = Invoke-WebRequest -Method Post -Uri $validationUrl -UseBasicParsing -TimeoutSec 5 -ContentType 'application/json' -Body '{}'
47+
$invokeWebRequestArguments = @{
48+
Method = 'Post'
49+
Uri = $validationUrl
50+
TimeoutSec = 5
51+
ContentType = 'application/json'
52+
Body = '{}'
53+
}
54+
if ((Get-Command Invoke-WebRequest).Parameters.ContainsKey('UseBasicParsing')) {
55+
$invokeWebRequestArguments['UseBasicParsing'] = $true
56+
}
57+
$response = Invoke-WebRequest @invokeWebRequestArguments
4858
if ([string]$response.Content -eq $validationToken) {
4959
$validated = $true
5060
break

Tools/powershell/SampleValidation.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,15 @@ function Wait-ForHttpEndpoint {
232232
}
233233

234234
try {
235-
$response = Invoke-WebRequest -Uri $Url -UseBasicParsing -TimeoutSec 5 -MaximumRedirection 0
235+
$invokeWebRequestArguments = @{
236+
Uri = $Url
237+
TimeoutSec = 5
238+
MaximumRedirection = 0
239+
}
240+
if ((Get-Command Invoke-WebRequest).Parameters.ContainsKey('UseBasicParsing')) {
241+
$invokeWebRequestArguments['UseBasicParsing'] = $true
242+
}
243+
$response = Invoke-WebRequest @invokeWebRequestArguments
236244
if ($AllowedStatusCodes -contains [int]$response.StatusCode) {
237245
return $response
238246
}
@@ -301,7 +309,7 @@ function Ensure-BrowserTooling {
301309
[switch]$SkipInstall
302310
)
303311

304-
$playwrightPath = Join-Path $ToolRoot 'node_modules\playwright'
312+
$playwrightPath = Join-Path $ToolRoot 'node_modules/playwright'
305313
if (-not (Test-Path $playwrightPath)) {
306314
if ($SkipInstall) {
307315
Write-Host 'Shared browser validation tooling is missing; installing it even though -SkipInstall was specified.' -ForegroundColor Yellow

0 commit comments

Comments
 (0)