Skip to content

Commit

Permalink
Add script for testing example
Browse files Browse the repository at this point in the history
  • Loading branch information
AlisherAmonulloev committed Sep 16, 2024
1 parent 78ff015 commit 60d2516
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
1 change: 1 addition & 0 deletions jQuery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"scripts": {
"start": "npm run lite",
"build": "npm run lint",
"lite": "lite-server -c ./bs-config.json",
"lint-html": "prettier --check src/*",
"lint-js": "eslint --ext .js .",
Expand Down
73 changes: 73 additions & 0 deletions test-example.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
param (
[string]$version = "latest"
)

function Process-JavaScriptProjects {
param (
[string]$Path = ".",
[string[]]$Folders = @("jQuery", "Angular", "Vue", "React")
)
Write-Host "Processing JavaScript Projects"

foreach ($folder in $Folders) {
if (-not (Test-Path $folder)) {
Write-Host "Directory $folder does not exist. Skipping..."
continue
}

Write-Host "`nProcessing folder: $folder"

Set-Location $folder

Write-Host "Running 'npm install' in $folder"
$installResult = & npm install -PassThru
if ($LASTEXITCODE -ne 0) {
Write-Error "npm install failed in $folder"
$errorCode = 1
}

Write-Host "Running 'npm run build' in $folder"
$buildResult = & npm run build -PassThru
if ($LASTEXITCODE -ne 0) {
Write-Error "npm run build failed in $folder"
$errorCode = 1
}

Set-Location ..
}
}

function Process-DotNetProjects {
param (
[string]$RootDirectory = "."
)
Write-Host "`nProcessing .NET Projects";

$slnFiles = Get-ChildItem -Path $RootDirectory -Filter *.sln -Recurse -Depth 1

if ($slnFiles.Count -eq 0) {
Write-Host "No solution files (.sln) found in the specified directory at level 1."
exit 1
}

foreach ($slnFile in $slnFiles) {
Write-Host "Found solution file: $($slnFile.FullName)"

dotnet build $slnFile.FullName -c Release

if ($LASTEXITCODE -eq 0) {
Write-Host "Build succeeded for $($slnFile.FullName)."
} else {
Write-Host "Build failed for $($slnFile.FullName)."
errorCode = 1;
}
}
}

$errorCode = 0;

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

exit $errorCode

0 comments on commit 60d2516

Please sign in to comment.