updating build
This commit is contained in:
parent
a8ee4022bf
commit
8be4bfe6f2
8 changed files with 122 additions and 34 deletions
59
scripts/clean.ps1
Normal file
59
scripts/clean.ps1
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
param(
|
||||
[switch]$modules,
|
||||
[switch]$dist,
|
||||
[switch]$all,
|
||||
[switch]$fresh
|
||||
)
|
||||
|
||||
function Remove-DirectoriesByName {
|
||||
param([string]$Name, [string]$Description)
|
||||
|
||||
Write-Host "Removing $Description..." -ForegroundColor Blue
|
||||
$directories = Get-ChildItem -Path . -Name $Name -Recurse -Directory -ErrorAction SilentlyContinue
|
||||
|
||||
if ($directories.Count -gt 0) {
|
||||
Write-Host "Found $($directories.Count) $Description to remove" -ForegroundColor Gray
|
||||
$directories | ForEach-Object {
|
||||
Remove-Item $_ -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Write-Host " Removed: $_" -ForegroundColor Gray
|
||||
}
|
||||
} else {
|
||||
Write-Host "No $Description found" -ForegroundColor Gray
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Starting cleanup..." -ForegroundColor Yellow
|
||||
|
||||
if ($all -or $fresh) {
|
||||
Remove-DirectoriesByName "node_modules" "node_modules directories"
|
||||
Remove-DirectoriesByName "dist" "dist directories"
|
||||
|
||||
Write-Host "Removing lock files..." -ForegroundColor Blue
|
||||
Remove-Item -Path "bun.lockb" -Force -ErrorAction SilentlyContinue
|
||||
Get-ChildItem -Path . -Name "bun.lockb" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
|
||||
|
||||
# Remove turbo clean since PowerShell already cleaned everything
|
||||
Write-Host "Cleanup complete - no need for turbo clean" -ForegroundColor Blue
|
||||
}
|
||||
elseif ($modules) {
|
||||
Remove-DirectoriesByName "node_modules" "node_modules directories"
|
||||
|
||||
Write-Host "Removing lock files..." -ForegroundColor Blue
|
||||
Remove-Item -Path "bun.lockb" -Force -ErrorAction SilentlyContinue
|
||||
Get-ChildItem -Path . -Name "bun.lockb" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
elseif ($dist) {
|
||||
Remove-DirectoriesByName "dist" "dist directories"
|
||||
}
|
||||
else {
|
||||
Write-Host "Running turbo clean..." -ForegroundColor Blue
|
||||
# Only run turbo clean for the default case
|
||||
turbo run clean
|
||||
}
|
||||
|
||||
if ($fresh) {
|
||||
Write-Host "Installing dependencies..." -ForegroundColor Green
|
||||
bun install
|
||||
}
|
||||
|
||||
Write-Host "Cleanup complete!" -ForegroundColor Green
|
||||
Loading…
Add table
Add a link
Reference in a new issue