test(buildserver): build serer checks

This commit is contained in:
2025-03-14 07:36:33 -05:00
parent c2c43b1e22
commit dd88f258ed

60
server/scripts/build.ps1 Normal file
View File

@@ -0,0 +1,60 @@
param (
[string]$dir,
[string]$app
)
# Store the original directory
$originalDir = Get-Location
Write-Host $originalDir
# Check if the directory is provided
if (-not $dir) {
Write-Host "Error: Directory parameter is required."
exit 1
}
# Check if the directory exists
if (-not (Test-Path $dir)) {
Write-Host "Error: Directory '$dir' does not exist."
exit 1
}
# Navigate to the directory
Set-Location -Path $dir
Write-Host "Cleaning the app."
# Function to delete all `dist` and `.turbo` folders recursively
function Delete-Folders {
param (
[string]$folderName
)
# Define the directories to search (packages and apps)
$searchDirectories = @("/", "frontend")
foreach ($searchDir in $searchDirectories) {
$fullSearchPath = Join-Path -Path $dir -ChildPath $searchDir
# Check if the directory exists
if (Test-Path $fullSearchPath) {
# Find all folders matching the name
$folders = Get-ChildItem -Path $fullSearchPath -Recurse -Directory -Filter $folderName -ErrorAction SilentlyContinue
if ($folders) {
#Write-Host "Deleting all '$folderName' folders in $fullSearchPath and its subdirectories..."
foreach ($folder in $folders) {
#Write-Host "Deleting: $($folder.FullName)"
Remove-Item -Path $folder.FullName -Recurse -Force
}
} else {
# Write-Host "No '$folderName' folders found in $fullSearchPath and its subdirectories."
}
} else {
# Write-Host "Directory '$fullSearchPath' does not exist."
}
}
}
Delete-Folders -folderName "dist"