From 3fdcffae667af5fce3f1f4615f0c068be8da7e30 Mon Sep 17 00:00:00 2001 From: AlisherAmonulloev Date: Sun, 24 Nov 2024 14:37:33 +0200 Subject: [PATCH] Update test-example.ps1 --- test-example.ps1 | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/test-example.ps1 b/test-example.ps1 index d68b1db..57d500d 100644 --- a/test-example.ps1 +++ b/test-example.ps1 @@ -1,40 +1,51 @@ param ( [string]$version = "latest" ) -$branchName = $env:branchName +$global:build = $env:buildVersion -ne $null ? $env:buildVersion : $version -Write-Host "Branch name: $branchName" +Write-Host "Build: $build" $global:errorCode = 0 - function Process-JavaScriptProjects { param ( [string]$Path = ".", - [string[]]$Folders = @("jQuery", "Angular", "Vue", "React") + [hashtable[]]$Folders = @( + @{ Name = "jQuery"; Packages = @("devextreme", "devextreme-dist") }, + @{ Name = "Angular"; Packages = @("devextreme", "devextreme-angular") }, + @{ Name = "Vue"; Packages = @("devextreme", "devextreme-vue") }, + @{ Name = "React"; Packages = @("devextreme", "devextreme-react") } + ) ) Write-Host "Processing JavaScript Projects" foreach ($folder in $Folders) { - if (-not (Test-Path $folder)) { - Write-Host "Directory $folder does not exist. Skipping..." + if (-not (Test-Path $($folder.Name))) { + Write-Host "Directory $($folder.Name) does not exist. Skipping..." continue } - Write-Host "`nProcessing folder: $folder" + Write-Host "`nProcessing folder: $($folder.Name)" - Set-Location $folder + Set-Location $($folder.Name) + + Write-Host "`nUpdating packages..." + foreach ($package in $($folder.Packages)) { + $command = "npm install $package@$global:build --save" + Write-Output "Running: $command" + Invoke-Expression $command + } - Write-Host "Running 'npm install' in $folder" + Write-Host "Running 'npm install' in $($folder.Name)" $installResult = & npm install --loglevel=error -PassThru if ($LASTEXITCODE -ne 0) { - Write-Error "npm install failed in $folder" + Write-Error "npm install failed in $($folder.Name)" $global:errorCode = 1 } - Write-Host "Running 'npm run build' in $folder" + Write-Host "Running 'npm run build' in $($folder.Name)" $buildResult = & npm run build if ($LASTEXITCODE -ne 0) { - Write-Error "npm run build failed in $folder" + Write-Error "npm run build failed in $($folder.Name)" $global:errorCode = 1 }