yymaxapi 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/yymaxapi.js +14 -3
- package/package.json +1 -1
package/bin/yymaxapi.js
CHANGED
|
@@ -3040,10 +3040,21 @@ async function autoInstallGitWindows() {
|
|
|
3040
3040
|
}
|
|
3041
3041
|
}
|
|
3042
3042
|
|
|
3043
|
-
// 方式2: 下载 Git
|
|
3044
|
-
const spinner = ora({ text: '
|
|
3043
|
+
// 方式2: 下载 Git 安装包(动态获取最新版本号)
|
|
3044
|
+
const spinner = ora({ text: '正在获取 Git 最新版本...', spinner: 'dots' }).start();
|
|
3045
3045
|
const installerPath = path.join(os.tmpdir(), 'git-installer.exe');
|
|
3046
|
-
|
|
3046
|
+
let downloadUrl;
|
|
3047
|
+
try {
|
|
3048
|
+
const tagJson = execSync('powershell -Command "(Invoke-RestMethod https://api.github.com/repos/git-for-windows/git/releases/latest).tag_name"', { stdio: 'pipe', timeout: 30000 }).toString().trim();
|
|
3049
|
+
// tag 格式: v2.48.1.windows.1 → 需要转成 Git-2.48.1-64-bit.exe
|
|
3050
|
+
const ver = tagJson.replace(/^v/, '').replace(/\.windows\.\d+$/, '');
|
|
3051
|
+
downloadUrl = `https://github.com/git-for-windows/git/releases/latest/download/Git-${ver}-64-bit.exe`;
|
|
3052
|
+
spinner.text = `正在下载 Git ${ver}...`;
|
|
3053
|
+
} catch (e) {
|
|
3054
|
+
// fallback: 用固定版本
|
|
3055
|
+
downloadUrl = 'https://github.com/git-for-windows/git/releases/download/v2.48.1.windows.1/Git-2.48.1-64-bit.exe';
|
|
3056
|
+
spinner.text = '正在下载 Git 安装包...';
|
|
3057
|
+
}
|
|
3047
3058
|
|
|
3048
3059
|
try {
|
|
3049
3060
|
execSync(`powershell -Command "Invoke-WebRequest -Uri '${downloadUrl}' -OutFile '${installerPath}'"`, {
|