Files
ax_hub_mcp_tool/dto_refactor.ps1
jade fc8c3da666
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 30s
refactor: apply MSA naming standard for DTOs and Scaffold template (Req->Request, Res->Response)
2026-07-24 10:07:50 +09:00

35 lines
1.7 KiB
PowerShell

$ErrorActionPreference = "Stop"
$extensions = @("*.java", "*.xml", "*.yml", "*.properties", "*.gradle", "*.md")
$baseDir = "C:\eGovFrameDev-4.3.1-64bit\workspace-egov\axhub-backend-main"
Write-Host "Replacing text (Req -> Request, Res -> Response)..."
Get-ChildItem -Path $baseDir -Include $extensions -Recurse -File | ForEach-Object {
if ($_.FullName -notmatch "\\build\\" -and $_.FullName -notmatch "\\\.git\\" -and $_.FullName -notmatch "\\\.gradle\\" -and $_.FullName -notmatch "\\bin\\") {
try {
$content = Get-Content $_.FullName -Raw -Encoding UTF8
$newContent = $content -creplace "Req\b", "Request"
$newContent = $newContent -creplace "Res\b", "Response"
if ($content -cne $newContent) {
Write-Host "Updated text in: $($_.FullName)"
$utf8NoBom = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllText($_.FullName, $newContent, $utf8NoBom)
}
} catch {
Write-Host "Skipped binary or locked file: $($_.FullName)"
}
}
}
Write-Host "Renaming DTO files..."
Get-ChildItem -Path $baseDir -Include *Req.java,*Res.java -Recurse -File | ForEach-Object {
if ($_.FullName -notmatch "\\build\\" -and $_.FullName -notmatch "\\\.git\\" -and $_.FullName -notmatch "\\\.gradle\\" -and $_.FullName -notmatch "\\bin\\") {
$newName = $_.Name -creplace "Req\.java$", "Request.java"
$newName = $newName -creplace "Res\.java$", "Response.java"
Write-Host "Renaming file: $($_.FullName) -> $newName"
Rename-Item -Path $_.FullName -NewName $newName
}
}
Write-Host "DTO Refactoring completed!"