From f683b1db4f443af0a899db95c65fe65d55d90947 Mon Sep 17 00:00:00 2001 From: admin123 Date: Mon, 25 May 2026 14:22:59 +0800 Subject: [PATCH] fix: keep release archive wrapped in a folder --- dist-release/manifest.json | 2 +- release/latest.json | 8 ++++---- .../star-chart-search-enhancer-internal.zip | Bin 100781 -> 101573 bytes scripts/package-release-archive.mjs | 14 +++++++++----- tests/package-release-archive.test.ts | 5 ++++- 5 files changed, 18 insertions(+), 11 deletions(-) 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 7ae5acc2bac2675d5c0378dc8452b4e1b9e73fbb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I{U|4O- hz`%#%mZCBwbI=2n6`0-`7`TDZ6&Q^{Z9rEr008d8-M#<- 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" + ); }); });