Skip to content

Commit

Permalink
Update test-example.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
AlisherAmonulloev committed Nov 27, 2024
1 parent 31021ae commit c58aca1
Showing 1 changed file with 31 additions and 18 deletions.
49 changes: 31 additions & 18 deletions test-example.ps1
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
param (
[string]$version = "latest"
)
$global:build = $env:id

Write-Host "Build number: $build"
if (-not $env:buildVersion) {
$global:buildVersion = "latest"
} else {
$global:buildVersion = $env:buildVersion
}
Write-Host "Build: $buildVersion"
$global:errorCode = 0

function Process-JavaScriptProjects {
param (
[string]$Path = ".",
[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") }
@{ Name = "jQuery"; Packages = @("devextreme-dist", "devextreme") },
@{ Name = "Angular"; Packages = @("devextreme-angular", "devextreme") },
@{ Name = "Vue"; Packages = @("devextreme-vue", "devextreme") },
@{ Name = "React"; Packages = @("devextreme-react", "devextreme") }
)
)
Write-Host "Processing JavaScript Projects"
Expand All @@ -28,25 +31,35 @@ function Process-JavaScriptProjects {

Set-Location $($folder.Name)

Write-Host "`nUpdating packages..."
foreach ($package in $($folder.Packages)) {
# Construct the npm install command
$command = "npm install $package@$global:build --save"
# Prepare the list of packages with their versions
$packages = $folder.Packages | ForEach-Object { "$_@$global:buildVersion" }

# Write the command for debugging
Write-Output "Running: $command"
# Join the package list into a single string
$packageList = $packages -join " "

# Run the command
Invoke-Expression $command
}
# Construct the npm install command
$command = "npm install $packageList --force --save --no-fund"

# Output and execute the command
Write-Output "Running: $command"
Invoke-Expression $command

Write-Host "Running 'npm install' in $($folder.Name)"
$installResult = & npm install --loglevel=error -PassThru
$installResult = & npm install --force --no-fund --loglevel=error -PassThru
if ($LASTEXITCODE -ne 0) {
Write-Error "npm install failed in $($folder.Name)"
$global:errorCode = 1
}

Write-Host "`nUpdating packages..."
#foreach ($package in $($folder.Packages)) {
# $command = "npm install $package@$global:buildVersion --save"
# Write-Output "Running: $command"
# Invoke-Expression $command
#}



Write-Host "Running 'npm run build' in $($folder.Name)"
$buildResult = & npm run build
if ($LASTEXITCODE -ne 0) {
Expand Down Expand Up @@ -86,7 +99,7 @@ function Process-DotNetProjects {
}
}

Write-Host "Version: $version"
Write-Host "Version: $global:buildVersion"
Process-JavaScriptProjects
Process-DotNetProjects

Expand Down

0 comments on commit c58aca1

Please sign in to comment.