-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean.ps1
More file actions
117 lines (94 loc) · 4.82 KB
/
clean.ps1
File metadata and controls
117 lines (94 loc) · 4.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Clean Script
# Cleans all build outputs for C#, JavaScript, and Python projects
# Usage: .\clean.ps1
Write-Host "DevPossible.Ton - Clean All Build Outputs" -ForegroundColor Cyan
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host ""
# Function to remove directory if it exists
function Remove-DirectoryIfExists {
param([string]$Path, [string]$Description)
if (Test-Path $Path) {
Write-Host " Removing $Description..." -ForegroundColor Yellow
Remove-Item -Path $Path -Recurse -Force -ErrorAction SilentlyContinue
Write-Host " ✓ Removed: $Path" -ForegroundColor Green
}
}
# Function to remove files matching pattern
function Remove-FilesIfExist {
param([string]$Path, [string]$Pattern, [string]$Description)
$files = Get-ChildItem -Path $Path -Filter $Pattern -Recurse -ErrorAction SilentlyContinue
if ($files) {
Write-Host " Removing $Description..." -ForegroundColor Yellow
foreach ($file in $files) {
Remove-Item -Path $file.FullName -Force -ErrorAction SilentlyContinue
Write-Host " ✓ Removed: $($file.FullName)" -ForegroundColor Green
}
}
}
# Clean C# / .NET Projects
Write-Host "Cleaning C# / .NET Projects..." -ForegroundColor Cyan
Write-Host "------------------------------" -ForegroundColor Cyan
# Clean main library
Remove-DirectoryIfExists "src\CSharp\DevPossible.Ton\bin" "C# library bin"
Remove-DirectoryIfExists "src\CSharp\DevPossible.Ton\obj" "C# library obj"
# Clean test project
Remove-DirectoryIfExists "src\CSharp\DevPossible.Ton.Tests\bin" "C# tests bin"
Remove-DirectoryIfExists "src\CSharp\DevPossible.Ton.Tests\obj" "C# tests obj"
Remove-DirectoryIfExists "src\CSharp\DevPossible.Ton.Tests\TestResults" "C# test results"
# Clean samples
Remove-DirectoryIfExists "src\CSharp\DevPossible.Ton.Samples\bin" "C# samples bin"
Remove-DirectoryIfExists "src\CSharp\DevPossible.Ton.Samples\obj" "C# samples obj"
# Remove NuGet packages from root
Remove-FilesIfExist "." "*.nupkg" "NuGet packages"
Write-Host ""
# Clean JavaScript / TypeScript Projects
Write-Host "Cleaning JavaScript / TypeScript Projects..." -ForegroundColor Cyan
Write-Host "-------------------------------------------" -ForegroundColor Cyan
# Clean main library
Remove-DirectoryIfExists "src\JavaScript\devpossible-ton\node_modules" "JavaScript library node_modules"
Remove-DirectoryIfExists "src\JavaScript\devpossible-ton\dist" "JavaScript library dist"
Remove-FilesIfExist "src\JavaScript\devpossible-ton" "*.tgz" "npm packages"
# Clean samples
Remove-DirectoryIfExists "src\JavaScript\devpossible-ton-samples\node_modules" "JavaScript samples node_modules"
Write-Host ""
# Clean Python Projects
Write-Host "Cleaning Python Projects..." -ForegroundColor Cyan
Write-Host "---------------------------" -ForegroundColor Cyan
# Clean main library
Remove-DirectoryIfExists "src\Python\devpossible_ton\dist" "Python library dist"
Remove-DirectoryIfExists "src\Python\devpossible_ton\build" "Python library build"
Remove-DirectoryIfExists "src\Python\devpossible_ton\devpossible_ton.egg-info" "Python library egg-info"
# Clean __pycache__ directories
$pycacheDirs = Get-ChildItem -Path "src\Python" -Filter "__pycache__" -Recurse -Directory -ErrorAction SilentlyContinue
if ($pycacheDirs) {
Write-Host " Removing Python cache directories..." -ForegroundColor Yellow
foreach ($dir in $pycacheDirs) {
Remove-Item -Path $dir.FullName -Recurse -Force -ErrorAction SilentlyContinue
Write-Host " ✓ Removed: $($dir.FullName)" -ForegroundColor Green
}
}
# Clean .pyc files
$pycFiles = Get-ChildItem -Path "src\Python" -Filter "*.pyc" -Recurse -File -ErrorAction SilentlyContinue
if ($pycFiles) {
Write-Host " Removing Python compiled files (.pyc)..." -ForegroundColor Yellow
foreach ($file in $pycFiles) {
Remove-Item -Path $file.FullName -Force -ErrorAction SilentlyContinue
Write-Host " ✓ Removed: $($file.FullName)" -ForegroundColor Green
}
}
Write-Host ""
# Clean documentation build outputs (optional)
Write-Host "Cleaning Documentation Build Outputs..." -ForegroundColor Cyan
Write-Host "---------------------------------------" -ForegroundColor Cyan
Remove-DirectoryIfExists "doc\doc-html\bin" "Documentation bin"
Remove-DirectoryIfExists "doc\doc-html\obj" "Documentation obj"
Remove-DirectoryIfExists "doc\node_modules" "Documentation node_modules"
Write-Host ""
Write-Host "============================================" -ForegroundColor Cyan
Write-Host "Clean Complete!" -ForegroundColor Green
Write-Host "============================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host " - Run .\build.ps1 to rebuild all projects" -ForegroundColor White
Write-Host " - Run .\test.ps1 to run all tests" -ForegroundColor White
Write-Host ""