From 57cd81d5518b7b51a11892c5313c3dbe1d68a38c Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Mon, 7 Sep 2026 13:33:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20AGC=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=9C=A8=20Windows=20=E4=B8=8A=E7=9A=84?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98=E5=B9=B6=E6=BE=84=E6=B8=85?= =?UTF-8?q?=20bump-version=20=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - build-release.test.mjs 用 fileURLToPath 替代 URL.pathname,修复 Windows 下 /C:/... 路径导致的 3 个用例失败(既有的跨平台问题) - bump-version.mjs 的 --no-commit 输出改为“已写入版本文件,未创建提交”,避免被误认为不改文件的干跑 --- .../ai-game-creator-shell/scripts/build-release.test.mjs | 9 ++++++--- apps/ai-game-creator-shell/scripts/bump-version.mjs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/ai-game-creator-shell/scripts/build-release.test.mjs b/apps/ai-game-creator-shell/scripts/build-release.test.mjs index fdeb4200b..912251c6e 100644 --- a/apps/ai-game-creator-shell/scripts/build-release.test.mjs +++ b/apps/ai-game-creator-shell/scripts/build-release.test.mjs @@ -1,6 +1,7 @@ import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { test } from 'node:test'; +import { fileURLToPath } from 'node:url'; import { bumpVersion, @@ -10,7 +11,9 @@ import { } from './build-release.mjs'; test('selects an explicit release artifact when configured', () => { - const artifactPath = new URL('../package.json', import.meta.url).pathname; + const artifactPath = fileURLToPath( + new URL('../package.json', import.meta.url), + ); const previous = process.env.AGC_UPDATE_ARTIFACT; process.env.AGC_UPDATE_ARTIFACT = artifactPath; try { @@ -30,7 +33,7 @@ test('does not select unsupported files', () => { test('manifest contains version, download URL and integrity fields', () => { const manifest = createUpdateManifest( - new URL('../package.json', import.meta.url).pathname, + fileURLToPath(new URL('../package.json', import.meta.url)), ); assert.match(manifest.version, /^\d+\.\d+\.\d+$/u); assert.match( @@ -46,7 +49,7 @@ test('manifest preserves multiline release notes', () => { process.env.AGC_UPDATE_RELEASE_NOTES = '第一行\n第二行\r\n第三行'; try { const manifest = createUpdateManifest( - new URL('../package.json', import.meta.url).pathname, + fileURLToPath(new URL('../package.json', import.meta.url)), ); assert.equal(manifest.releaseNotes, '第一行\n第二行\r\n第三行'); } finally { diff --git a/apps/ai-game-creator-shell/scripts/bump-version.mjs b/apps/ai-game-creator-shell/scripts/bump-version.mjs index 2723dffab..33205b4f3 100644 --- a/apps/ai-game-creator-shell/scripts/bump-version.mjs +++ b/apps/ai-game-creator-shell/scripts/bump-version.mjs @@ -43,7 +43,7 @@ writeVersionFiles(next); if (noCommit) { console.log( - `[bump-version] 版本 ${current} -> ${next}(dry-run,未提交,如需提交去掉 --no-commit)`, + `[bump-version] 版本 ${current} -> ${next}(已写入版本文件,未创建提交,可用 git diff 复核;去掉 --no-commit 即提交)`, ); process.exit(0); }