-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean.ps1
executable file
·41 lines (32 loc) · 1.35 KB
/
clean.ps1
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
#!/usr/bin/env pwsh
$ErrorActionPreference = "Stop"
Write-Host "---------------------------------------------------------"
Write-Host "Clean [Windows/Linux]: <Powershell>"
Write-Host "---------------------------------------------------------"
# Get the current directory
$CallDir = $pwd
# Go to the location of this directory even if the script is being run from
# somewhere else
Set-Location $PSScriptRoot
# Go to the root directory of this repository
Set-Location ..
# Remove temporary directories
$BinaryDir = "bin"
$DistDir = "dist"
$DocsDir = "docs"
$InstallerDir = "installer"
$LogsDir = "logs"
$NodeModulesDir = "node_modules"
$TmpDir = "tmp"
$DirectoriesToRemove = $BinaryDir,$DistDir,$DocsDir,$LogsDir,$NodeModulesDir,$TmpDir
$FilesToRemoveFromInstallerDir = Get-ChildItem -Recurse -Include "*.log","*.zst","*.log","*.bin","*.svg","*.git","*.pkg","*.tar","logpipe.*","*.log.*" $InstallerDir
Remove-Item $DirectoriesToRemove -ErrorAction Ignore -Recurse -Force -Confirm:$false
foreach ($FileToRemoveFromInstallerDir in $FilesToRemoveFromInstallerDir)
{
Remove-Item $FileToRemoveFromInstallerDir.FullName -ErrorAction Ignore -Force -Recurse -Confirm:$false
}
# Go back to the call directory
Set-Location $CallDir
# Wait for any input before closing the window
Write-Host "`n>> The script has finished. Press any key to close the window."
[Console]::ReadKey()