@@ -32,6 +32,21 @@ function Invoke-ScriptWithLogging {
3232 Write-Host " "
3333}
3434
35+
36+ $script :startTime = Get-Date
37+
38+ function Write-ElapsedTime {
39+ [CmdletBinding ()]
40+ param (
41+ [Parameter (Mandatory = $true )]
42+ [string ]$Message
43+ )
44+
45+ $elapsedTime = [math ]::Round(((Get-Date ) - $script :startTime ).TotalSeconds, 1 )
46+ Write-Host " ${Message} . Total elapsed time: $elapsedTime seconds"
47+ Write-Host " "
48+ }
49+
3550function Get-GitHubApiHeaders {
3651 param (
3752 [Parameter (Mandatory = $false )]
@@ -265,6 +280,8 @@ else {
265280 }
266281}
267282
283+ Write-ElapsedTime " Spec retrieved"
284+
268285Push-Location $repoRootPath
269286
270287try {
@@ -273,10 +290,13 @@ try {
273290 exit $LASTEXITCODE
274291 }
275292
293+ Write-ElapsedTime " npm ci complete"
294+
276295 Invoke-ScriptWithLogging { npm run build - w $codegenFolderPath }
277296 if ($LASTEXITCODE -ne 0 ) {
278297 exit $LASTEXITCODE
279298 }
299+ Write-ElapsedTime " npm run build complete"
280300
281301 Set-Location $specificationFolderPath
282302 Invoke-ScriptWithLogging { npx tsp compile . -- stats -- trace @typespec / http- client- csharp }
@@ -285,9 +305,6 @@ finally {
285305 Pop-Location
286306}
287307
288- $scriptElapsed = $ (Get-Date ) - $scriptStartTime
289- $scriptElapsedSeconds = [math ]::Round($scriptElapsed.TotalSeconds , 1 )
290308$scriptName = $MyInvocation.MyCommand.Name
291309
292- Write-Host " ${scriptName} completed. Time: ${scriptElapsedSeconds} s"
293- Write-Host " "
310+ Write-ElapsedTime " ${scriptName} completed"
0 commit comments