diff --git a/test b/test new file mode 100644 index 0000000..7d2a233 --- /dev/null +++ b/test @@ -0,0 +1,31 @@ + # 1. 定义文件名 + $fileName = "github_mirror.lua" + + # 2. 获取当前工作目录的绝对路径 (例如: D:\a\your-repo\your-repo) + $currentDir = Get-Location + + # 3. 拼接出绝对文件路径 (例如: D:\a\your-re_repo\your-repo\github_mirror.lua) + $absoluteFilePath = Join-Path $currentDir $fileName + + # 4. 定义 Lua 脚本内容 + $luaContent = @' + function mirror(url) + -- 强制将 github.com 替换为镜像域名 + url = url:gsub("github.com", "github.bibk.top") + return url + end + + -- main 函数允许处理该 URL + function main(url, host) + return true + end + '@ + + # 5. 使用绝对路径写入文件 + $luaContent | Out-File -FilePath $absoluteFilePath -Encoding utf8 + + # 6. 输出调试信息 (可选,确认路径是否正确) + Write-Host "Mirror config generated at: $absoluteFilePath" + + # 7. 配置 Xmake 使用该绝对路径的配置文件 + xmake g --proxy_pac=$absoluteFilePath \ No newline at end of file