54 lines
1.5 KiB
PowerShell
54 lines
1.5 KiB
PowerShell
# show-frontend-structure.ps1
|
|
# Displays the frontend folder structure
|
|
|
|
param(
|
|
[string]$Path = "static",
|
|
[string]$OutputFile = "frontend-structure.txt"
|
|
)
|
|
|
|
function Show-Tree {
|
|
param(
|
|
[string]$Path,
|
|
[string]$Indent = "",
|
|
[bool]$IsLast = $true,
|
|
[System.IO.StreamWriter]$Writer
|
|
)
|
|
|
|
$item = Get-Item $Path
|
|
$prefix = if ($Indent -eq "") { "" } else { if ($IsLast) { "└── " } else { "├── " } }
|
|
|
|
$line = $Indent + $prefix + $item.Name
|
|
$Writer.WriteLine($line)
|
|
Write-Host $line
|
|
|
|
if ($item.PSIsContainer) {
|
|
$items = Get-ChildItem $Path | Sort-Object Name
|
|
$count = $items.Count
|
|
|
|
for ($i = 0; $i -lt $count; $i++) {
|
|
$newIndent = $Indent + $(if ($Indent -eq "") { "" } else { if ($IsLast) { " " } else { "│ " } })
|
|
$isLast = ($i -eq ($count - 1))
|
|
Show-Tree -Path $items[$i].FullName -Indent $newIndent -IsLast $isLast -Writer $Writer
|
|
}
|
|
}
|
|
}
|
|
|
|
Write-Host "Generating frontend structure..." -ForegroundColor Green
|
|
Write-Host "Output will be saved to: $OutputFile" -ForegroundColor Yellow
|
|
Write-Host ""
|
|
|
|
$writer = [System.IO.StreamWriter]::new($OutputFile)
|
|
$writer.WriteLine("Frontend Folder Structure")
|
|
$writer.WriteLine("Generated: $(Get-Date)")
|
|
$writer.WriteLine("=" * 80)
|
|
$writer.WriteLine("")
|
|
|
|
Show-Tree -Path $Path -Writer $writer
|
|
|
|
$writer.Close()
|
|
|
|
Write-Host ""
|
|
Write-Host "✅ Structure saved to $OutputFile" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "Opening file..." -ForegroundColor Cyan
|
|
Start-Process notepad.exe $OutputFile |