diff --git a/dist-release/manifest.json b/dist-release/manifest.json index f621263..ef39e2b 100644 --- a/dist-release/manifest.json +++ b/dist-release/manifest.json @@ -47,7 +47,7 @@ ] } ], - "version": "0.0525.4", + "version": "0.0525.6", "host_permissions": [ "https://xingtu.cn/ad/creator/market*", "https://*.xingtu.cn/ad/creator/market*", diff --git a/release/latest.json b/release/latest.json index 03d7992..4190758 100644 --- a/release/latest.json +++ b/release/latest.json @@ -1,11 +1,11 @@ { - "guideUrl": "https://wksgx-1343191620.cos.ap-nanjing.myqcloud.com/star-chart-search-enhancer/releases/0.0525.4/星图增强插件-超简单安装使用指南.pdf", - "latestVersion": "0.0525.4", - "minSupportedVersion": "0.0525.4", + "guideUrl": "https://wksgx-1343191620.cos.ap-nanjing.myqcloud.com/star-chart-search-enhancer/releases/0.0525.6/星图增强插件-超简单安装使用指南.pdf", + "latestVersion": "0.0525.6", + "minSupportedVersion": "0.0525.6", "publishedAt": "2026-05-25", "releaseNotes": [ "支持在插件弹窗中检查新版本", "支持一键下载最新版插件压缩包和使用说明" ], - "zipUrl": "https://wksgx-1343191620.cos.ap-nanjing.myqcloud.com/star-chart-search-enhancer/releases/0.0525.4/star-chart-search-enhancer-internal.zip" + "zipUrl": "https://wksgx-1343191620.cos.ap-nanjing.myqcloud.com/star-chart-search-enhancer/releases/0.0525.6/star-chart-search-enhancer-internal.zip" } diff --git a/release/star-chart-search-enhancer-internal.zip b/release/star-chart-search-enhancer-internal.zip index 7ae5acc..a6f4205 100644 Binary files a/release/star-chart-search-enhancer-internal.zip and b/release/star-chart-search-enhancer-internal.zip differ diff --git a/scripts/package-release-archive.mjs b/scripts/package-release-archive.mjs index cf0c37c..c426ca7 100644 --- a/scripts/package-release-archive.mjs +++ b/scripts/package-release-archive.mjs @@ -4,16 +4,20 @@ import path from "node:path"; import { pipeline } from "node:stream/promises"; import yazl from "yazl"; -export async function createReleaseArchive({ archivePath, sourceDir }) { +export async function createReleaseArchive({ + archivePath, + rootDirName = "star-chart-search-enhancer-internal", + sourceDir +}) { const zip = new yazl.ZipFile(); const output = createWriteStream(archivePath); - await addDirectory(zip, sourceDir, sourceDir); + await addDirectory(zip, sourceDir, sourceDir, rootDirName); zip.end(); await pipeline(zip.outputStream, output); } -async function addDirectory(zip, rootDir, currentDir) { +async function addDirectory(zip, rootDir, currentDir, rootDirName) { const entries = await readdir(currentDir, { withFileTypes: true }); entries.sort((left, right) => left.name.localeCompare(right.name)); @@ -22,12 +26,12 @@ async function addDirectory(zip, rootDir, currentDir) { const relativePath = path.relative(rootDir, absolutePath); if (entry.isDirectory()) { - await addDirectory(zip, rootDir, absolutePath); + await addDirectory(zip, rootDir, absolutePath, rootDirName); continue; } if (entry.isFile()) { - zip.addFile(absolutePath, relativePath); + zip.addFile(absolutePath, path.join(rootDirName, relativePath)); } } } diff --git a/tests/package-release-archive.test.ts b/tests/package-release-archive.test.ts index 28e772c..2411ae9 100644 --- a/tests/package-release-archive.test.ts +++ b/tests/package-release-archive.test.ts @@ -6,7 +6,7 @@ import { describe, expect, test } from "vitest"; import { createReleaseArchive } from "../scripts/package-release-archive.mjs"; describe("package-release-archive", () => { - test("creates a zip archive without relying on the system zip binary", async () => { + test("creates a zip archive with a top-level release folder", async () => { const tempDir = await mkdtemp(path.join(os.tmpdir(), "release-archive-")); const sourceDir = path.join(tempDir, "source"); const archivePath = path.join(tempDir, "archive.zip"); @@ -21,5 +21,8 @@ describe("package-release-archive", () => { const archive = await readFile(archivePath); expect(archive.byteLength).toBeGreaterThan(0); + expect(archive.toString("utf8")).toContain( + "star-chart-search-enhancer-internal/hello.txt" + ); }); });