Skip to content

Commit c58aca1

Browse files
Update test-example.ps1
1 parent 31021ae commit c58aca1

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

test-example.ps1

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
param (
22
[string]$version = "latest"
33
)
4-
$global:build = $env:id
5-
6-
Write-Host "Build number: $build"
4+
if (-not $env:buildVersion) {
5+
$global:buildVersion = "latest"
6+
} else {
7+
$global:buildVersion = $env:buildVersion
8+
}
9+
Write-Host "Build: $buildVersion"
710
$global:errorCode = 0
811

912
function Process-JavaScriptProjects {
1013
param (
1114
[string]$Path = ".",
1215
[hashtable[]]$Folders = @(
13-
@{ Name = "jQuery"; Packages = @("devextreme", "devextreme-dist") },
14-
@{ Name = "Angular"; Packages = @("devextreme", "devextreme-angular") },
15-
@{ Name = "Vue"; Packages = @("devextreme", "devextreme-vue") },
16-
@{ Name = "React"; Packages = @("devextreme", "devextreme-react") }
16+
@{ Name = "jQuery"; Packages = @("devextreme-dist", "devextreme") },
17+
@{ Name = "Angular"; Packages = @("devextreme-angular", "devextreme") },
18+
@{ Name = "Vue"; Packages = @("devextreme-vue", "devextreme") },
19+
@{ Name = "React"; Packages = @("devextreme-react", "devextreme") }
1720
)
1821
)
1922
Write-Host "Processing JavaScript Projects"
@@ -28,25 +31,35 @@ function Process-JavaScriptProjects {
2831

2932
Set-Location $($folder.Name)
3033

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

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

39-
# Run the command
40-
Invoke-Expression $command
41-
}
40+
# Construct the npm install command
41+
$command = "npm install $packageList --force --save --no-fund"
4242

43+
# Output and execute the command
44+
Write-Output "Running: $command"
45+
Invoke-Expression $command
46+
4347
Write-Host "Running 'npm install' in $($folder.Name)"
44-
$installResult = & npm install --loglevel=error -PassThru
48+
$installResult = & npm install --force --no-fund --loglevel=error -PassThru
4549
if ($LASTEXITCODE -ne 0) {
4650
Write-Error "npm install failed in $($folder.Name)"
4751
$global:errorCode = 1
4852
}
4953

54+
Write-Host "`nUpdating packages..."
55+
#foreach ($package in $($folder.Packages)) {
56+
# $command = "npm install $package@$global:buildVersion --save"
57+
# Write-Output "Running: $command"
58+
# Invoke-Expression $command
59+
#}
60+
61+
62+
5063
Write-Host "Running 'npm run build' in $($folder.Name)"
5164
$buildResult = & npm run build
5265
if ($LASTEXITCODE -ne 0) {
@@ -86,7 +99,7 @@ function Process-DotNetProjects {
8699
}
87100
}
88101

89-
Write-Host "Version: $version"
102+
Write-Host "Version: $global:buildVersion"
90103
Process-JavaScriptProjects
91104
Process-DotNetProjects
92105

0 commit comments

Comments
 (0)