修复小程序wxapi 的依赖全部改成 api
This commit is contained in:
39
codes/agent/game-docker/fix-lf.ps1
Normal file
39
codes/agent/game-docker/fix-lf.ps1
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env pwsh
|
||||
# fix-lf.ps1 — 检查并修复 game-docker 中关键文件的行尾符(CRLF → LF)
|
||||
# 在上传部署前运行,确保 shell 脚本等文件在 Linux 容器中可正常执行
|
||||
|
||||
$root = $PSScriptRoot
|
||||
|
||||
$patterns = @('*.sh', '*.conf', '*.env', 'Dockerfile', 'deploy.sh', 'init-ssl.sh',
|
||||
'docker-compose*.yml', '*.yaml', 'entrypoint*')
|
||||
|
||||
Write-Host "扫描目录: $root" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
$files = $patterns | ForEach-Object {
|
||||
Get-ChildItem -Path $root -Recurse -Filter $_ -File
|
||||
} | Sort-Object FullName -Unique
|
||||
|
||||
$crlfFiles = $files | Where-Object {
|
||||
$bytes = [System.IO.File]::ReadAllBytes($_.FullName)
|
||||
($bytes | Where-Object { $_ -eq 13 } | Measure-Object).Count -gt 0
|
||||
}
|
||||
|
||||
if (-not $crlfFiles) {
|
||||
Write-Host "✓ 所有关键文件行尾符正常(LF),无需修复。" -ForegroundColor Green
|
||||
exit 0
|
||||
}
|
||||
|
||||
Write-Host "发现 $($crlfFiles.Count) 个文件含 CRLF,正在修复..." -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
|
||||
foreach ($f in $crlfFiles) {
|
||||
$content = [System.IO.File]::ReadAllText($f.FullName)
|
||||
$fixed = $content -replace "`r`n", "`n"
|
||||
[System.IO.File]::WriteAllText($f.FullName, $fixed, [System.Text.UTF8Encoding]::new($false))
|
||||
$rel = $f.FullName.Substring($root.Length + 1)
|
||||
Write-Host " 已修复: $rel" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "✓ 修复完成,共处理 $($crlfFiles.Count) 个文件。" -ForegroundColor Green
|
||||
Reference in New Issue
Block a user