mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
chore(build): 删除文件夹映射配置和命名空间更新脚本
- 移除 folder-mappings.json 配置文件 - 删除 update-namespaces.sh 自动化脚本 - 清理项目中的文件夹重命名映射关系 - 移除自动生成命名空间更新的功能 - 完成代码库结构规范化清理工作
This commit is contained in:
parent
f48a8db094
commit
8b5efc69ec
@ -1,618 +0,0 @@
|
||||
{
|
||||
"projects": [
|
||||
{
|
||||
"name": "GFramework.Core.Abstractions",
|
||||
"path": "GFramework.Core.Abstractions",
|
||||
"folders": [
|
||||
{
|
||||
"old": "cqrs/behaviors",
|
||||
"new": "CQRS/Behaviors"
|
||||
},
|
||||
{
|
||||
"old": "cqrs/command",
|
||||
"new": "CQRS/Command"
|
||||
},
|
||||
{
|
||||
"old": "cqrs/notification",
|
||||
"new": "CQRS/Notification"
|
||||
},
|
||||
{
|
||||
"old": "cqrs/query",
|
||||
"new": "CQRS/Query"
|
||||
},
|
||||
{
|
||||
"old": "cqrs/request",
|
||||
"new": "CQRS/Request"
|
||||
},
|
||||
{
|
||||
"old": "cqrs",
|
||||
"new": "CQRS"
|
||||
},
|
||||
{
|
||||
"old": "architecture",
|
||||
"new": "Architecture"
|
||||
},
|
||||
{
|
||||
"old": "bases",
|
||||
"new": "Bases"
|
||||
},
|
||||
{
|
||||
"old": "command",
|
||||
"new": "Command"
|
||||
},
|
||||
{
|
||||
"old": "configuration",
|
||||
"new": "Configuration"
|
||||
},
|
||||
{
|
||||
"old": "controller",
|
||||
"new": "Controller"
|
||||
},
|
||||
{
|
||||
"old": "coroutine",
|
||||
"new": "Coroutine"
|
||||
},
|
||||
{
|
||||
"old": "data",
|
||||
"new": "Data"
|
||||
},
|
||||
{
|
||||
"old": "enums",
|
||||
"new": "Enums"
|
||||
},
|
||||
{
|
||||
"old": "environment",
|
||||
"new": "Environment"
|
||||
},
|
||||
{
|
||||
"old": "events",
|
||||
"new": "Events"
|
||||
},
|
||||
{
|
||||
"old": "internals",
|
||||
"new": "Internals"
|
||||
},
|
||||
{
|
||||
"old": "ioc",
|
||||
"new": "IoC"
|
||||
},
|
||||
{
|
||||
"old": "lifecycle",
|
||||
"new": "Lifecycle"
|
||||
},
|
||||
{
|
||||
"old": "logging",
|
||||
"new": "Logging"
|
||||
},
|
||||
{
|
||||
"old": "model",
|
||||
"new": "Model"
|
||||
},
|
||||
{
|
||||
"old": "pause",
|
||||
"new": "Pause"
|
||||
},
|
||||
{
|
||||
"old": "pool",
|
||||
"new": "Pool"
|
||||
},
|
||||
{
|
||||
"old": "properties",
|
||||
"new": "Properties"
|
||||
},
|
||||
{
|
||||
"old": "property",
|
||||
"new": "Property"
|
||||
},
|
||||
{
|
||||
"old": "query",
|
||||
"new": "Query"
|
||||
},
|
||||
{
|
||||
"old": "registries",
|
||||
"new": "Registries"
|
||||
},
|
||||
{
|
||||
"old": "resource",
|
||||
"new": "Resource"
|
||||
},
|
||||
{
|
||||
"old": "rule",
|
||||
"new": "Rule"
|
||||
},
|
||||
{
|
||||
"old": "serializer",
|
||||
"new": "Serializer"
|
||||
},
|
||||
{
|
||||
"old": "state",
|
||||
"new": "State"
|
||||
},
|
||||
{
|
||||
"old": "storage",
|
||||
"new": "Storage"
|
||||
},
|
||||
{
|
||||
"old": "system",
|
||||
"new": "System"
|
||||
},
|
||||
{
|
||||
"old": "time",
|
||||
"new": "Time"
|
||||
},
|
||||
{
|
||||
"old": "utility",
|
||||
"new": "Utility"
|
||||
},
|
||||
{
|
||||
"old": "versioning",
|
||||
"new": "Versioning"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GFramework.Core",
|
||||
"path": "GFramework.Core",
|
||||
"folders": [
|
||||
{
|
||||
"old": "cqrs/behaviors",
|
||||
"new": "CQRS/Behaviors"
|
||||
},
|
||||
{
|
||||
"old": "cqrs/command",
|
||||
"new": "CQRS/Command"
|
||||
},
|
||||
{
|
||||
"old": "cqrs/notification",
|
||||
"new": "CQRS/Notification"
|
||||
},
|
||||
{
|
||||
"old": "cqrs/query",
|
||||
"new": "CQRS/Query"
|
||||
},
|
||||
{
|
||||
"old": "cqrs/request",
|
||||
"new": "CQRS/Request"
|
||||
},
|
||||
{
|
||||
"old": "cqrs",
|
||||
"new": "CQRS"
|
||||
},
|
||||
{
|
||||
"old": "coroutine/extensions",
|
||||
"new": "Coroutine/Extensions"
|
||||
},
|
||||
{
|
||||
"old": "coroutine/instructions",
|
||||
"new": "Coroutine/Instructions"
|
||||
},
|
||||
{
|
||||
"old": "coroutine",
|
||||
"new": "Coroutine"
|
||||
},
|
||||
{
|
||||
"old": "functional/async",
|
||||
"new": "Functional/Async"
|
||||
},
|
||||
{
|
||||
"old": "functional/control",
|
||||
"new": "Functional/Control"
|
||||
},
|
||||
{
|
||||
"old": "functional/functions",
|
||||
"new": "Functional/Functions"
|
||||
},
|
||||
{
|
||||
"old": "functional/pipe",
|
||||
"new": "Functional/Pipe"
|
||||
},
|
||||
{
|
||||
"old": "functional/result",
|
||||
"new": "Functional/Result"
|
||||
},
|
||||
{
|
||||
"old": "functional",
|
||||
"new": "Functional"
|
||||
},
|
||||
{
|
||||
"old": "logging/appenders",
|
||||
"new": "Logging/Appenders"
|
||||
},
|
||||
{
|
||||
"old": "logging/filters",
|
||||
"new": "Logging/Filters"
|
||||
},
|
||||
{
|
||||
"old": "log/formatters",
|
||||
"new": "Logging/Formatters"
|
||||
},
|
||||
{
|
||||
"old": "logging",
|
||||
"new": "Logging"
|
||||
},
|
||||
{
|
||||
"old": "services/modules",
|
||||
"new": "Services/Modules"
|
||||
},
|
||||
{
|
||||
"old": "services",
|
||||
"new": "Services"
|
||||
},
|
||||
{
|
||||
"old": "architecture",
|
||||
"new": "Architecture"
|
||||
},
|
||||
{
|
||||
"old": "command",
|
||||
"new": "Command"
|
||||
},
|
||||
{
|
||||
"old": "configuration",
|
||||
"new": "Configuration"
|
||||
},
|
||||
{
|
||||
"old": "environment",
|
||||
"new": "Environment"
|
||||
},
|
||||
{
|
||||
"old": "events",
|
||||
"new": "Events"
|
||||
},
|
||||
{
|
||||
"old": "extensions",
|
||||
"new": "Extensions"
|
||||
},
|
||||
{
|
||||
"old": "ioc",
|
||||
"new": "IoC"
|
||||
},
|
||||
{
|
||||
"old": "model",
|
||||
"new": "Model"
|
||||
},
|
||||
{
|
||||
"old": "pause",
|
||||
"new": "Pause"
|
||||
},
|
||||
{
|
||||
"old": "pool",
|
||||
"new": "Pool"
|
||||
},
|
||||
{
|
||||
"old": "property",
|
||||
"new": "Property"
|
||||
},
|
||||
{
|
||||
"old": "query",
|
||||
"new": "Query"
|
||||
},
|
||||
{
|
||||
"old": "resource",
|
||||
"new": "Resource"
|
||||
},
|
||||
{
|
||||
"old": "rule",
|
||||
"new": "Rule"
|
||||
},
|
||||
{
|
||||
"old": "state",
|
||||
"new": "State"
|
||||
},
|
||||
{
|
||||
"old": "system",
|
||||
"new": "System"
|
||||
},
|
||||
{
|
||||
"old": "time",
|
||||
"new": "Time"
|
||||
},
|
||||
{
|
||||
"old": "utility",
|
||||
"new": "Utility"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GFramework.Core.Tests",
|
||||
"path": "GFramework.Core.Tests",
|
||||
"folders": [
|
||||
{
|
||||
"old": "architecture",
|
||||
"new": "Architecture"
|
||||
},
|
||||
{
|
||||
"old": "extensions",
|
||||
"new": "Extensions"
|
||||
},
|
||||
{
|
||||
"old": "logging",
|
||||
"new": "Logging"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GFramework.Game.Abstractions",
|
||||
"path": "GFramework.Game.Abstractions",
|
||||
"folders": [
|
||||
{
|
||||
"old": "data",
|
||||
"new": "Data"
|
||||
},
|
||||
{
|
||||
"old": "scene",
|
||||
"new": "Scene"
|
||||
},
|
||||
{
|
||||
"old": "serializer",
|
||||
"new": "Serializer"
|
||||
},
|
||||
{
|
||||
"old": "setting/events",
|
||||
"new": "Setting/Events"
|
||||
},
|
||||
{
|
||||
"old": "setting",
|
||||
"new": "Setting"
|
||||
},
|
||||
{
|
||||
"old": "state",
|
||||
"new": "State"
|
||||
},
|
||||
{
|
||||
"old": "storage",
|
||||
"new": "Storage"
|
||||
},
|
||||
{
|
||||
"old": "ui/handler",
|
||||
"new": "UI/Handler"
|
||||
},
|
||||
{
|
||||
"old": "ui",
|
||||
"new": "UI"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GFramework.Game",
|
||||
"path": "GFramework.Game",
|
||||
"folders": [
|
||||
{
|
||||
"old": "data",
|
||||
"new": "Data"
|
||||
},
|
||||
{
|
||||
"old": "extensions",
|
||||
"new": "Extensions"
|
||||
},
|
||||
{
|
||||
"old": "scene/handler",
|
||||
"new": "Scene/Handler"
|
||||
},
|
||||
{
|
||||
"old": "scene",
|
||||
"new": "Scene"
|
||||
},
|
||||
{
|
||||
"old": "serializer",
|
||||
"new": "Serializer"
|
||||
},
|
||||
{
|
||||
"old": "setting/events",
|
||||
"new": "Setting/Events"
|
||||
},
|
||||
{
|
||||
"old": "setting",
|
||||
"new": "Setting"
|
||||
},
|
||||
{
|
||||
"old": "state",
|
||||
"new": "State"
|
||||
},
|
||||
{
|
||||
"old": "storage",
|
||||
"new": "Storage"
|
||||
},
|
||||
{
|
||||
"old": "ui/handler",
|
||||
"new": "UI/Handler"
|
||||
},
|
||||
{
|
||||
"old": "ui",
|
||||
"new": "UI"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GFramework.Godot",
|
||||
"path": "GFramework.Godot",
|
||||
"folders": [
|
||||
{
|
||||
"old": "extensions/signal",
|
||||
"new": "Extensions/Signal"
|
||||
},
|
||||
{
|
||||
"old": "extensions",
|
||||
"new": "Extensions"
|
||||
},
|
||||
{
|
||||
"old": "setting/data",
|
||||
"new": "Setting/Data"
|
||||
},
|
||||
{
|
||||
"old": "setting",
|
||||
"new": "Setting"
|
||||
},
|
||||
{
|
||||
"old": "architecture",
|
||||
"new": "Architecture"
|
||||
},
|
||||
{
|
||||
"old": "coroutine",
|
||||
"new": "Coroutine"
|
||||
},
|
||||
{
|
||||
"old": "data",
|
||||
"new": "Data"
|
||||
},
|
||||
{
|
||||
"old": "logging",
|
||||
"new": "Logging"
|
||||
},
|
||||
{
|
||||
"old": "pause",
|
||||
"new": "Pause"
|
||||
},
|
||||
{
|
||||
"old": "pool",
|
||||
"new": "Pool"
|
||||
},
|
||||
{
|
||||
"old": "scene",
|
||||
"new": "Scene"
|
||||
},
|
||||
{
|
||||
"old": "storage",
|
||||
"new": "Storage"
|
||||
},
|
||||
{
|
||||
"old": "ui",
|
||||
"new": "UI"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GFramework.Ecs.Arch.Abstractions",
|
||||
"path": "GFramework.Ecs.Arch.Abstractions",
|
||||
"folders": [
|
||||
{
|
||||
"old": "components",
|
||||
"new": "Components"
|
||||
},
|
||||
{
|
||||
"old": "systems",
|
||||
"new": "Systems"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GFramework.Ecs.Arch",
|
||||
"path": "GFramework.Ecs.Arch",
|
||||
"folders": [
|
||||
{
|
||||
"old": "components",
|
||||
"new": "Components"
|
||||
},
|
||||
{
|
||||
"old": "extensions",
|
||||
"new": "Extensions"
|
||||
},
|
||||
{
|
||||
"old": "systems",
|
||||
"new": "Systems"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GFramework.Ecs.Arch.Tests",
|
||||
"path": "GFramework.Ecs.Arch.Tests",
|
||||
"folders": [
|
||||
{
|
||||
"old": "integration",
|
||||
"new": "Integration"
|
||||
},
|
||||
{
|
||||
"old": "systems",
|
||||
"new": "Systems"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GFramework.SourceGenerators.Abstractions",
|
||||
"path": "GFramework.SourceGenerators.Abstractions",
|
||||
"folders": [
|
||||
{
|
||||
"old": "bases",
|
||||
"new": "Bases"
|
||||
},
|
||||
{
|
||||
"old": "diagnostics",
|
||||
"new": "Diagnostics"
|
||||
},
|
||||
{
|
||||
"old": "enums",
|
||||
"new": "Enums"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GFramework.SourceGenerators",
|
||||
"path": "GFramework.SourceGenerators",
|
||||
"folders": [
|
||||
{
|
||||
"old": "analyzers",
|
||||
"new": "Analyzers"
|
||||
},
|
||||
{
|
||||
"old": "bases",
|
||||
"new": "Bases"
|
||||
},
|
||||
{
|
||||
"old": "diagnostics",
|
||||
"new": "Diagnostics"
|
||||
},
|
||||
{
|
||||
"old": "enums",
|
||||
"new": "Enums"
|
||||
},
|
||||
{
|
||||
"old": "logging",
|
||||
"new": "Logging"
|
||||
},
|
||||
{
|
||||
"old": "rule",
|
||||
"new": "Rule"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GFramework.Godot.SourceGenerators.Abstractions",
|
||||
"path": "GFramework.Godot.SourceGenerators.Abstractions",
|
||||
"folders": [
|
||||
{
|
||||
"old": "bases",
|
||||
"new": "Bases"
|
||||
},
|
||||
{
|
||||
"old": "diagnostics",
|
||||
"new": "Diagnostics"
|
||||
},
|
||||
{
|
||||
"old": "enums",
|
||||
"new": "Enums"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "GFramework.Godot.SourceGenerators",
|
||||
"path": "GFramework.Godot.SourceGenerators",
|
||||
"folders": [
|
||||
{
|
||||
"old": "analyzers",
|
||||
"new": "Analyzers"
|
||||
},
|
||||
{
|
||||
"old": "bases",
|
||||
"new": "Bases"
|
||||
},
|
||||
{
|
||||
"old": "diagnostics",
|
||||
"new": "Diagnostics"
|
||||
},
|
||||
{
|
||||
"old": "enums",
|
||||
"new": "Enums"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,104 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
param(
|
||||
[switch]$DryRun,
|
||||
[switch]$SkipTests,
|
||||
[string]$Phase = "all"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Write-Phase {
|
||||
param([string]$Message)
|
||||
Write-Host "`n========================================" -ForegroundColor Cyan
|
||||
Write-Host $Message -ForegroundColor Cyan
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
function Invoke-GitCommand {
|
||||
param([string]$Command)
|
||||
if ($DryRun) {
|
||||
Write-Host "[DRY RUN] git $Command" -ForegroundColor Yellow
|
||||
} else {
|
||||
Invoke-Expression "git $Command"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Git command failed: git $Command"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Phase 0: Preparation
|
||||
if ($Phase -eq "all" -or $Phase -eq "0") {
|
||||
Write-Phase "Phase 0: Preparation"
|
||||
|
||||
# Check clean working directory
|
||||
$status = git status --porcelain
|
||||
if ($status) {
|
||||
Write-Error "Working directory is not clean. Please commit or stash changes first."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Create backup tag
|
||||
Write-Host "Creating backup tag..."
|
||||
Invoke-GitCommand "tag backup-before-namespace-refactor-$(Get-Date -Format 'yyyyMMdd-HHmmss')"
|
||||
|
||||
# Run baseline tests
|
||||
if (-not $SkipTests) {
|
||||
Write-Host "Running baseline tests..."
|
||||
dotnet test
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Baseline tests failed. Please fix before proceeding."
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "✓ Preparation complete" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Phase 1: Rename folders
|
||||
if ($Phase -eq "all" -or $Phase -eq "1") {
|
||||
Write-Phase "Phase 1: Rename Folders"
|
||||
|
||||
# Load mappings
|
||||
$mappingsJson = Get-Content "folder-mappings.json" -Raw | ConvertFrom-Json
|
||||
|
||||
foreach ($project in $mappingsJson.projects) {
|
||||
Write-Host "`nProcessing project: $($project.name)" -ForegroundColor Yellow
|
||||
|
||||
# Sort folders by depth (deepest first) to avoid conflicts
|
||||
$sortedFolders = $project.folders | Sort-Object { ($_.old -split '/').Count } -Descending
|
||||
|
||||
foreach ($mapping in $sortedFolders) {
|
||||
$oldPath = Join-Path $project.path $mapping.old
|
||||
$newPath = Join-Path $project.path $mapping.new
|
||||
|
||||
if (Test-Path $oldPath) {
|
||||
# Windows case-insensitive workaround
|
||||
if ($mapping.old.ToLower() -eq $mapping.new.ToLower()) {
|
||||
$tempPath = "$oldPath`_temp"
|
||||
Write-Host " Renaming (2-step): $($mapping.old) → $($mapping.new)"
|
||||
Invoke-GitCommand "mv `"$oldPath`" `"$tempPath`""
|
||||
Invoke-GitCommand "mv `"$tempPath`" `"$newPath`""
|
||||
} else {
|
||||
Write-Host " Renaming: $($mapping.old) → $($mapping.new)"
|
||||
Invoke-GitCommand "mv `"$oldPath`" `"$newPath`""
|
||||
}
|
||||
} else {
|
||||
Write-Host " Skipping (not found): $($mapping.old)" -ForegroundColor Gray
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $DryRun) {
|
||||
Write-Host "`nCommitting folder renames..."
|
||||
git commit -m "refactor: rename folders to PascalCase (phase 1)"
|
||||
}
|
||||
|
||||
Write-Host "✓ Phase 1 complete" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Host "`n✓ Script execution complete!" -ForegroundColor Green
|
||||
Write-Host "Next steps:" -ForegroundColor Cyan
|
||||
Write-Host " 1. Run: ./update-namespaces.ps1" -ForegroundColor White
|
||||
Write-Host " 2. Run: ./update-documentation.ps1" -ForegroundColor White
|
||||
Write-Host " 3. Run: ./verify-namespaces.ps1" -ForegroundColor White
|
||||
@ -1,135 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
param(
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host "Phase 3: Update Documentation" -ForegroundColor Cyan
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
# Namespace mapping (same as update-namespaces.ps1)
|
||||
$namespaceMap = [ordered]@{
|
||||
# Nested namespaces first
|
||||
"\.cqrs\.behaviors" = ".CQRS.Behaviors"
|
||||
"\.cqrs\.command" = ".CQRS.Command"
|
||||
"\.cqrs\.notification" = ".CQRS.Notification"
|
||||
"\.cqrs\.query" = ".CQRS.Query"
|
||||
"\.cqrs\.request" = ".CQRS.Request"
|
||||
"\.coroutine\.extensions" = ".Coroutine.Extensions"
|
||||
"\.coroutine\.instructions" = ".Coroutine.Instructions"
|
||||
"\.functional\.async" = ".Functional.Async"
|
||||
"\.functional\.control" = ".Functional.Control"
|
||||
"\.functional\.functions" = ".Functional.Functions"
|
||||
"\.functional\.pipe" = ".Functional.Pipe"
|
||||
"\.functional\.result" = ".Functional.Result"
|
||||
"\.logging\.appenders" = ".Logging.Appenders"
|
||||
"\.logging\.filters" = ".Logging.Filters"
|
||||
"\.logging\.formatters" = ".Logging.Formatters"
|
||||
"\.services\.modules" = ".Services.Modules"
|
||||
"\.setting\.events" = ".Setting.Events"
|
||||
"\.setting\.data" = ".Setting.Data"
|
||||
"\.scene\.handler" = ".Scene.Handler"
|
||||
"\.ui\.handler" = ".UI.Handler"
|
||||
"\.extensions\.signal" = ".Extensions.Signal"
|
||||
|
||||
# Single-level namespaces
|
||||
"\.cqrs" = ".CQRS"
|
||||
"\.ioc" = ".IoC"
|
||||
"\.ui" = ".UI"
|
||||
"\.ecs" = ".ECS"
|
||||
"\.architecture" = ".Architecture"
|
||||
"\.bases" = ".Bases"
|
||||
"\.command" = ".Command"
|
||||
"\.configuration" = ".Configuration"
|
||||
"\.controller" = ".Controller"
|
||||
"\.coroutine" = ".Coroutine"
|
||||
"\.data" = ".Data"
|
||||
"\.enums" = ".Enums"
|
||||
"\.environment" = ".Environment"
|
||||
"\.events" = ".Events"
|
||||
"\.extensions" = ".Extensions"
|
||||
"\.functional" = ".Functional"
|
||||
"\.internals" = ".Internals"
|
||||
"\.lifecycle" = ".Lifecycle"
|
||||
"\.logging" = ".Logging"
|
||||
"\.model" = ".Model"
|
||||
"\.pause" = ".Pause"
|
||||
"\.pool" = ".Pool"
|
||||
"\.properties" = ".Properties"
|
||||
"\.property" = ".Property"
|
||||
"\.query" = ".Query"
|
||||
"\.registries" = ".Registries"
|
||||
"\.resource" = ".Resource"
|
||||
"\.rule" = ".Rule"
|
||||
"\.serializer" = ".Serializer"
|
||||
"\.services" = ".Services"
|
||||
"\.state" = ".State"
|
||||
"\.storage" = ".Storage"
|
||||
"\.system" = ".System"
|
||||
"\.time" = ".Time"
|
||||
"\.utility" = ".Utility"
|
||||
"\.versioning" = ".Versioning"
|
||||
"\.scene" = ".Scene"
|
||||
"\.setting" = ".Setting"
|
||||
"\.diagnostics" = ".Diagnostics"
|
||||
"\.components" = ".Components"
|
||||
"\.systems" = ".Systems"
|
||||
"\.analyzers" = ".Analyzers"
|
||||
}
|
||||
|
||||
# Get all Markdown files
|
||||
Write-Host "Finding Markdown files..."
|
||||
$mdFiles = @()
|
||||
$mdFiles += Get-ChildItem -Path "docs" -Filter "*.md" -Recurse -ErrorAction SilentlyContinue
|
||||
$mdFiles += Get-ChildItem -Path "." -Filter "README.md" -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.FullName -notmatch "node_modules" -and $_.FullName -notmatch "\\bin\\" -and $_.FullName -notmatch "\\obj\\" }
|
||||
Write-Host "Found $($mdFiles.Count) Markdown files`n"
|
||||
|
||||
$modifiedCount = 0
|
||||
|
||||
foreach ($file in $mdFiles) {
|
||||
$content = Get-Content $file.FullName -Raw -Encoding UTF8
|
||||
$originalContent = $content
|
||||
$fileModified = $false
|
||||
|
||||
# Update namespace references
|
||||
foreach ($mapping in $namespaceMap.GetEnumerator()) {
|
||||
$oldPattern = $mapping.Key
|
||||
$newPattern = $mapping.Value
|
||||
|
||||
# Match GFramework namespace references
|
||||
if ($content -match "GFramework[^\s;,\)]*$oldPattern") {
|
||||
$content = $content -replace "(GFramework[^\s;,\)]*)$oldPattern", "`$1$newPattern"
|
||||
$fileModified = $true
|
||||
}
|
||||
}
|
||||
|
||||
if ($fileModified) {
|
||||
$modifiedCount++
|
||||
$relativePath = $file.FullName.Replace((Get-Location).Path, "").TrimStart('\', '/')
|
||||
Write-Host "✓ Updated: $relativePath" -ForegroundColor Green
|
||||
|
||||
if (-not $DryRun) {
|
||||
Set-Content -Path $file.FullName -Value $content -NoNewline -Encoding UTF8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "`n========================================" -ForegroundColor Cyan
|
||||
Write-Host "Summary:" -ForegroundColor Cyan
|
||||
Write-Host " Total files scanned: $($mdFiles.Count)"
|
||||
Write-Host " Files modified: $modifiedCount"
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
if (-not $DryRun -and $modifiedCount -gt 0) {
|
||||
Write-Host "Committing documentation updates..."
|
||||
git add -A
|
||||
git commit -m "docs: update namespace references to PascalCase (phase 3)"
|
||||
Write-Host "✓ Phase 3 complete" -ForegroundColor Green
|
||||
} elseif ($DryRun) {
|
||||
Write-Host "[DRY RUN] No changes were made" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host "No files needed updating" -ForegroundColor Yellow
|
||||
}
|
||||
@ -1,153 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
param(
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host "Phase 2: Update Namespace Declarations" -ForegroundColor Cyan
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
# Namespace mapping (order matters - process longer patterns first)
|
||||
$namespaceMap = [ordered]@{
|
||||
# Nested namespaces first (to avoid partial replacements)
|
||||
"\.cqrs\.behaviors" = ".CQRS.Behaviors"
|
||||
"\.cqrs\.command" = ".CQRS.Command"
|
||||
"\.cqrs\.notification" = ".CQRS.Notification"
|
||||
"\.cqrs\.query" = ".CQRS.Query"
|
||||
"\.cqrs\.request" = ".CQRS.Request"
|
||||
"\.coroutine\.extensions" = ".Coroutine.Extensions"
|
||||
"\.coroutine\.instructions" = ".Coroutine.Instructions"
|
||||
"\.functional\.async" = ".Functional.Async"
|
||||
"\.functional\.control" = ".Functional.Control"
|
||||
"\.functional\.functions" = ".Functional.Functions"
|
||||
"\.functional\.pipe" = ".Functional.Pipe"
|
||||
"\.functional\.result" = ".Functional.Result"
|
||||
"\.logging\.appenders" = ".Logging.Appenders"
|
||||
"\.logging\.filters" = ".Logging.Filters"
|
||||
"\.logging\.formatters" = ".Logging.Formatters"
|
||||
"\.services\.modules" = ".Services.Modules"
|
||||
"\.setting\.events" = ".Setting.Events"
|
||||
"\.setting\.data" = ".Setting.Data"
|
||||
"\.scene\.handler" = ".Scene.Handler"
|
||||
"\.ui\.handler" = ".UI.Handler"
|
||||
"\.extensions\.signal" = ".Extensions.Signal"
|
||||
"\.events\.filters" = ".Events.Filters"
|
||||
"\.data\.events" = ".Data.Events"
|
||||
|
||||
# Single-level namespaces
|
||||
"\.cqrs" = ".CQRS"
|
||||
"\.ioc" = ".IoC"
|
||||
"\.ui" = ".UI"
|
||||
"\.ecs" = ".ECS"
|
||||
"\.architecture" = ".Architecture"
|
||||
"\.bases" = ".Bases"
|
||||
"\.command" = ".Command"
|
||||
"\.configuration" = ".Configuration"
|
||||
"\.constants" = ".Constants"
|
||||
"\.controller" = ".Controller"
|
||||
"\.coroutine" = ".Coroutine"
|
||||
"\.data" = ".Data"
|
||||
"\.enums" = ".Enums"
|
||||
"\.environment" = ".Environment"
|
||||
"\.events" = ".Events"
|
||||
"\.extensions" = ".Extensions"
|
||||
"\.functional" = ".Functional"
|
||||
"\.internals" = ".Internals"
|
||||
"\.lifecycle" = ".Lifecycle"
|
||||
"\.logging" = ".Logging"
|
||||
"\.model" = ".Model"
|
||||
"\.pause" = ".Pause"
|
||||
"\.pool" = ".Pool"
|
||||
"\.properties" = ".Properties"
|
||||
"\.property" = ".Property"
|
||||
"\.query" = ".Query"
|
||||
"\.registries" = ".Registries"
|
||||
"\.resource" = ".Resource"
|
||||
"\.rule" = ".Rule"
|
||||
"\.serializer" = ".Serializer"
|
||||
"\.services" = ".Services"
|
||||
"\.state" = ".State"
|
||||
"\.storage" = ".Storage"
|
||||
"\.system" = ".System"
|
||||
"\.time" = ".Time"
|
||||
"\.utility" = ".Utility"
|
||||
"\.versioning" = ".Versioning"
|
||||
"\.scene" = ".Scene"
|
||||
"\.setting" = ".Setting"
|
||||
"\.asset" = ".Asset"
|
||||
"\.registry" = ".Registry"
|
||||
"\.diagnostics" = ".Diagnostics"
|
||||
"\.components" = ".Components"
|
||||
"\.systems" = ".Systems"
|
||||
"\.integration" = ".Integration"
|
||||
"\.tests" = ".Tests"
|
||||
"\.mediator" = ".Mediator"
|
||||
"\.analyzers" = ".Analyzers"
|
||||
}
|
||||
|
||||
# Get all C# files
|
||||
Write-Host "Finding C# files..."
|
||||
$csFiles = Get-ChildItem -Path . -Filter "*.cs" -Recurse -Exclude "bin","obj" | Where-Object { $_.FullName -notmatch "\\bin\\" -and $_.FullName -notmatch "\\obj\\" }
|
||||
Write-Host "Found $($csFiles.Count) C# files`n"
|
||||
|
||||
$modifiedCount = 0
|
||||
|
||||
foreach ($file in $csFiles) {
|
||||
$content = Get-Content $file.FullName -Raw -Encoding UTF8
|
||||
$originalContent = $content
|
||||
$fileModified = $false
|
||||
|
||||
# Update namespace declarations and using statements
|
||||
foreach ($mapping in $namespaceMap.GetEnumerator()) {
|
||||
$oldPattern = $mapping.Key
|
||||
$newPattern = $mapping.Value
|
||||
|
||||
# Match namespace declarations: namespace GFramework.*\.old
|
||||
if ($content -match "namespace\s+GFramework[^;\{]*$oldPattern") {
|
||||
$content = $content -replace "(namespace\s+GFramework[^;\{]*)$oldPattern", "`$1$newPattern"
|
||||
$fileModified = $true
|
||||
}
|
||||
|
||||
# Match using statements: using GFramework.*\.old
|
||||
if ($content -match "using\s+GFramework[^;]*$oldPattern") {
|
||||
$content = $content -replace "(using\s+GFramework[^;]*)$oldPattern", "`$1$newPattern"
|
||||
$fileModified = $true
|
||||
}
|
||||
|
||||
# Match using static: using static GFramework.*\.old
|
||||
if ($content -match "using\s+static\s+GFramework[^;]*$oldPattern") {
|
||||
$content = $content -replace "(using\s+static\s+GFramework[^;]*)$oldPattern", "`$1$newPattern"
|
||||
$fileModified = $true
|
||||
}
|
||||
}
|
||||
|
||||
if ($fileModified) {
|
||||
$modifiedCount++
|
||||
$relativePath = $file.FullName.Replace((Get-Location).Path, "").TrimStart('\', '/')
|
||||
Write-Host "✓ Updated: $relativePath" -ForegroundColor Green
|
||||
|
||||
if (-not $DryRun) {
|
||||
Set-Content -Path $file.FullName -Value $content -NoNewline -Encoding UTF8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "`n========================================" -ForegroundColor Cyan
|
||||
Write-Host "Summary:" -ForegroundColor Cyan
|
||||
Write-Host " Total files scanned: $($csFiles.Count)"
|
||||
Write-Host " Files modified: $modifiedCount"
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
if (-not $DryRun -and $modifiedCount -gt 0) {
|
||||
Write-Host "Committing namespace updates..."
|
||||
git add -A
|
||||
git commit -m "refactor: update namespace declarations to PascalCase (phase 2)"
|
||||
Write-Host "✓ Phase 2 complete" -ForegroundColor Green
|
||||
} elseif ($DryRun) {
|
||||
Write-Host "[DRY RUN] No changes were made" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host "No files needed updating" -ForegroundColor Yellow
|
||||
}
|
||||
@ -1,119 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Phase 2: Update Namespace Declarations
|
||||
echo "========================================"
|
||||
echo "Phase 2: Update Namespace Declarations"
|
||||
echo "========================================"
|
||||
echo ""
|
||||
|
||||
# Find all C# files
|
||||
echo "Finding C# files..."
|
||||
cs_files=$(find . -name "*.cs" -type f ! -path "*/bin/*" ! -path "*/obj/*" ! -path "*/.git/*")
|
||||
total_files=$(echo "$cs_files" | wc -l)
|
||||
echo "Found $total_files C# files"
|
||||
echo ""
|
||||
|
||||
modified_count=0
|
||||
|
||||
# Process each file
|
||||
while IFS= read -r file; do
|
||||
if [ -f "$file" ]; then
|
||||
# Create a temporary file
|
||||
temp_file="${file}.tmp"
|
||||
|
||||
# Apply all namespace replacements
|
||||
sed -E \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)cqrs\.behaviors/\1 \2CQRS.Behaviors/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)cqrs\.command/\1 \2CQRS.Command/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)cqrs\.notification/\1 \2CQRS.Notification/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)cqrs\.query/\1 \2CQRS.Query/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)cqrs\.request/\1 \2CQRS.Request/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)coroutine\.extensions/\1 \2Coroutine.Extensions/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)coroutine\.instructions/\1 \2Coroutine.Instructions/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)functional\.async/\1 \2Functional.Async/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)functional\.control/\1 \2Functional.Control/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)functional\.functions/\1 \2Functional.Functions/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)functional\.pipe/\1 \2Functional.Pipe/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)functional\.result/\1 \2Functional.Result/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)logging\.appenders/\1 \2Logging.Appenders/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)logging\.filters/\1 \2Logging.Filters/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)logging\.formatters/\1 \2Logging.Formatters/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)services\.modules/\1 \2Services.Modules/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)setting\.events/\1 \2Setting.Events/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)setting\.data/\1 \2Setting.Data/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)scene\.handler/\1 \2Scene.Handler/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)ui\.handler/\1 \2UI.Handler/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)extensions\.signal/\1 \2Extensions.Signal/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)events\.filters/\1 \2Events.Filters/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)data\.events/\1 \2Data.Events/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)cqrs([^a-z])/\1 \2CQRS\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)ioc([^a-z])/\1 \2IoC\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)ui([^a-z])/\1 \2UI\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)ecs([^a-z])/\1 \2ECS\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)architecture([^a-z])/\1 \2Architecture\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)bases([^a-z])/\1 \2Bases\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)command([^a-z])/\1 \2Command\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)configuration([^a-z])/\1 \2Configuration\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)controller([^a-z])/\1 \2Controller\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)coroutine([^a-z])/\1 \2Coroutine\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)data([^a-z])/\1 \2Data\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)enums([^a-z])/\1 \2Enums\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)environment([^a-z])/\1 \2Environment\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)events([^a-z])/\1 \2Events\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)extensions([^a-z])/\1 \2Extensions\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)functional([^a-z])/\1 \2Functional\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)internals([^a-z])/\1 \2Internals\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)lifecycle([^a-z])/\1 \2Lifecycle\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)logging([^a-z])/\1 \2Logging\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)model([^a-z])/\1 \2Model\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)pause([^a-z])/\1 \2Pause\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)pool([^a-z])/\1 \2Pool\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)properties([^a-z])/\1 \2Properties\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)property([^a-z])/\1 \2Property\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)query([^a-z])/\1 \2Query\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)registries([^a-z])/\1 \2Registries\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)resource([^a-z])/\1 \2Resource\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)rule([^a-z])/\1 \2Rule\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)serializer([^a-z])/\1 \2Serializer\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)services([^a-z])/\1 \2Services\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)state([^a-z])/\1 \2State\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)storage([^a-z])/\1 \2Storage\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)system([^a-z])/\1 \2System\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)time([^a-z])/\1 \2Time\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)utility([^a-z])/\1 \2Utility\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)versioning([^a-z])/\1 \2Versioning\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)scene([^a-z])/\1 \2Scene\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)setting([^a-z])/\1 \2Setting\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)diagnostics([^a-z])/\1 \2Diagnostics\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)components([^a-z])/\1 \2Components\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)systems([^a-z])/\1 \2Systems\3/g' \
|
||||
-e 's/(namespace|using|using static)\s+(GFramework[^;{]*\.)analyzers([^a-z])/\1 \2Analyzers\3/g' \
|
||||
"$file" > "$temp_file"
|
||||
|
||||
# Check if file was modified
|
||||
if ! cmp -s "$file" "$temp_file"; then
|
||||
mv "$temp_file" "$file"
|
||||
echo "✓ Updated: ${file#./}"
|
||||
((modified_count++))
|
||||
else
|
||||
rm "$temp_file"
|
||||
fi
|
||||
fi
|
||||
done <<< "$cs_files"
|
||||
|
||||
echo ""
|
||||
echo "========================================"
|
||||
echo "Summary:"
|
||||
echo " Total files scanned: $total_files"
|
||||
echo " Files modified: $modified_count"
|
||||
echo "========================================"
|
||||
echo ""
|
||||
|
||||
if [ $modified_count -gt 0 ]; then
|
||||
echo "Committing namespace updates..."
|
||||
git add -A
|
||||
git commit -m "refactor: update namespace declarations to PascalCase (phase 2)"
|
||||
echo "✓ Phase 2 complete"
|
||||
else
|
||||
echo "No files needed updating"
|
||||
fi
|
||||
@ -1,108 +0,0 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host "Phase 4: Verify Namespace Consistency" -ForegroundColor Cyan
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
# Patterns to detect lowercase namespaces (should not exist after refactoring)
|
||||
$lowercasePatterns = @(
|
||||
"\.architecture\b",
|
||||
"\.bases\b",
|
||||
"\.command\b",
|
||||
"\.configuration\b",
|
||||
"\.controller\b",
|
||||
"\.coroutine\b",
|
||||
"\.cqrs\b",
|
||||
"\.data\b",
|
||||
"\.enums\b",
|
||||
"\.environment\b",
|
||||
"\.events\b",
|
||||
"\.extensions\b",
|
||||
"\.functional\b",
|
||||
"\.internals\b",
|
||||
"\.ioc\b",
|
||||
"\.lifecycle\b",
|
||||
"\.logging\b",
|
||||
"\.model\b",
|
||||
"\.pause\b",
|
||||
"\.pool\b",
|
||||
"\.properties\b",
|
||||
"\.property\b",
|
||||
"\.query\b",
|
||||
"\.registries\b",
|
||||
"\.resource\b",
|
||||
"\.rule\b",
|
||||
"\.serializer\b",
|
||||
"\.services\b",
|
||||
"\.state\b",
|
||||
"\.storage\b",
|
||||
"\.system\b",
|
||||
"\.time\b",
|
||||
"\.utility\b",
|
||||
"\.versioning\b",
|
||||
"\.ui\b",
|
||||
"\.ecs\b",
|
||||
"\.scene\b",
|
||||
"\.setting\b",
|
||||
"\.diagnostics\b",
|
||||
"\.components\b",
|
||||
"\.systems\b",
|
||||
"\.analyzers\b"
|
||||
)
|
||||
|
||||
Write-Host "Searching for lowercase namespaces in C# files..."
|
||||
$csFiles = Get-ChildItem -Path . -Filter "*.cs" -Recurse -Exclude "bin","obj" | Where-Object { $_.FullName -notmatch "\\bin\\" -and $_.FullName -notmatch "\\obj\\" }
|
||||
|
||||
$issues = @()
|
||||
|
||||
foreach ($file in $csFiles) {
|
||||
$content = Get-Content $file.FullName -Raw
|
||||
$lineNumber = 0
|
||||
|
||||
foreach ($line in (Get-Content $file.FullName)) {
|
||||
$lineNumber++
|
||||
|
||||
# Check if line contains namespace or using statement
|
||||
if ($line -match "^\s*(namespace|using)\s+GFramework") {
|
||||
foreach ($pattern in $lowercasePatterns) {
|
||||
if ($line -match $pattern) {
|
||||
$relativePath = $file.FullName.Replace((Get-Location).Path, "").TrimStart('\', '/')
|
||||
$issues += [PSCustomObject]@{
|
||||
File = $relativePath
|
||||
Line = $lineNumber
|
||||
Content = $line.Trim()
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($issues.Count -gt 0) {
|
||||
Write-Host "`n❌ Found $($issues.Count) lowercase namespace(s):`n" -ForegroundColor Red
|
||||
|
||||
foreach ($issue in $issues) {
|
||||
Write-Host " File: $($issue.File):$($issue.Line)" -ForegroundColor Yellow
|
||||
Write-Host " $($issue.Content)" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "Please review and fix these issues manually.`n" -ForegroundColor Red
|
||||
exit 1
|
||||
} else {
|
||||
Write-Host "✓ All namespaces are PascalCase!" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Host "`n========================================" -ForegroundColor Cyan
|
||||
Write-Host "Verification Summary:" -ForegroundColor Cyan
|
||||
Write-Host " Files scanned: $($csFiles.Count)"
|
||||
Write-Host " Issues found: $($issues.Count)"
|
||||
Write-Host "========================================`n" -ForegroundColor Cyan
|
||||
|
||||
if ($issues.Count -eq 0) {
|
||||
Write-Host "✓ Namespace verification passed!" -ForegroundColor Green
|
||||
exit 0
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user