From 5f57ed242023d0ec49291dd548fc4cfd9bbdc90d Mon Sep 17 00:00:00 2001 From: cflmy Date: Thu, 3 Dec 2026 10:43:28 +0800 Subject: [PATCH 1/2] feat: include Tools in the platform-grouped library downloads (marqdo#110) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Archive platform labels are now target-aware: platform-independent components (source target) keep tar.gz → Linux/macOS and zip → Windows; platform-specific Tools map both formats to their target platform (Linux x86_64), because zip is only a packaging convenience and never implies a Windows binary. The download centre lists the latest verified independent release of standard libraries, extensions and Tools under the matching platform, while the standalone tools section keeps the full cross-format list. --- src/components/Asset.astro | 2 +- src/components/Releases.astro | 4 ++-- src/components/pages/DownloadPage.astro | 23 +++++++++++++------- src/config/release-platforms.ts | 28 +++++++++++++++++++------ 4 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/components/Asset.astro b/src/components/Asset.astro index 5e3695f..b883a69 100644 --- a/src/components/Asset.astro +++ b/src/components/Asset.astro @@ -7,7 +7,7 @@ const { locale, snapshot, release, asset } = Astro.props as { locale: Locale; sn const t = (zh: T, en: T) => choose(locale, zh, en); const withdrawn = snapshot.withdrawals.some(row => [release.release_id, asset.asset_id].includes(row.id)); const platformNames = new Map(platforms.map(platform => [platform.id as string, platform.name])); -const libraryPlatforms = archivePlatformLabel(asset.name, platformNames); +const libraryPlatforms = archivePlatformLabel(asset.name, platformNames, asset.target); const platform = { supported: t('已支持', 'Supported'), 'build-verified': t('仅验证构建', 'Build verified'), diff --git a/src/components/Releases.astro b/src/components/Releases.astro index cfc4a08..6acc04b 100644 --- a/src/components/Releases.astro +++ b/src/components/Releases.astro @@ -38,11 +38,11 @@ const eligibleOffers = offers.filter(offer => recommendations.has(offer.offer_id }

{t('发行记录', 'Release records')}

-

{t('组件的独立发行和生态集成状态分别显示。库发行按平台习惯提供归档:Linux → tar.gz,Windows → zip,macOS → tar.gz(同一份文件)。', 'Component releases and their ecosystem integration status appear separately. Platform-independent library archives follow platform conventions: Linux → tar.gz, Windows → zip, macOS → tar.gz (the same file).')}

+

{t('组件的独立发行和生态集成状态分别显示。平台无关库按平台习惯提供归档:Linux → tar.gz,Windows → zip,macOS → tar.gz(同一份文件);平台相关 Tool 的 tar.gz/zip 均为同一 Linux 二进制,zip 只是格式便利。', 'Component releases and their ecosystem integration status appear separately. Platform-independent library archives follow platform conventions: Linux → tar.gz, Windows → zip, macOS → tar.gz (the same file); platform-specific Tools ship the same Linux binary in both formats, where zip is only a packaging convenience.')}

{snapshot && releases.map(row => { const recommended = eligibleOffers.some(offer => offer.components.some(member => member.release_id === row.release_id)); - const libraryFormats = [...new Set(row.assets.flatMap(asset => archivePlatforms(asset.name)))]; + const libraryFormats = [...new Set(row.assets.flatMap(asset => archivePlatforms(asset.name, asset.target)))]; const isLibrary = row.assets.every(asset => asset.target === 'source'); return
asset.target).join(' ')} data-library={isLibrary ? '1' : undefined} data-formats={libraryFormats.join(' ')}>

{row.component_id} · {row.version}

diff --git a/src/components/pages/DownloadPage.astro b/src/components/pages/DownloadPage.astro index 3c93b08..5aa7fdc 100644 --- a/src/components/pages/DownloadPage.astro +++ b/src/components/pages/DownloadPage.astro @@ -16,6 +16,7 @@ const products = [ const libraryGroups = [ { kind: 'extension', label: t('扩展库', 'Extensions') }, { kind: 'stdlib', label: t('标准库', 'Standard libraries') }, + { kind: 'tool', label: t('工具', 'Tools') }, ] as const; const snapshot = publication?.snapshot; @@ -32,10 +33,17 @@ const downloads = (snapshot?.offers ?? []).filter(offer => recommendations.has(o })); const latestLibraries = new Map(); +const latestToolReleases = new Map(); for (const { release, asset } of releaseAssets) { const kind = componentKinds.get(release.component_id); - if ((kind !== 'stdlib' && kind !== 'extension') || release.integration_state !== 'pending' - || asset.kind !== 'archive' || asset.target !== 'source' || archivePlatforms(asset.name).length === 0) continue; + if (kind === 'tool' && archivePlatforms(asset.name, asset.target).length > 0) { + const currentTool = latestToolReleases.get(release.component_id); + if (!currentTool || Date.parse(release.published_at) > Date.parse(currentTool.published_at)) { + latestToolReleases.set(release.component_id, release); + } + } + if ((kind !== 'stdlib' && kind !== 'extension' && kind !== 'tool') || release.integration_state !== 'pending' + || asset.kind !== 'archive' || archivePlatforms(asset.name, asset.target).length === 0) continue; const current = latestLibraries.get(release.component_id); if (!current || Date.parse(release.published_at) > Date.parse(current.release.published_at)) { @@ -55,7 +63,7 @@ const noData = t('暂时无法获取下载信息。', 'Download information is t

{t('下载 ', 'Download ')}Marqdo

-

{t('获取应用安装包及标准库、扩展库的独立发行。', 'Get application packages and independent releases of standard and extension libraries.')}

+

{t('获取应用安装包及标准库、扩展库与工具的独立发行。', 'Get application packages and independent releases of standard libraries, extensions and tools.')}

@@ -82,7 +90,7 @@ const noData = t('暂时无法获取下载信息。', 'Download information is t
{snapshot ? t('暂无 ' + platform.name + ' 推荐安装包', 'No recommended packages for ' + platform.name) : noData} - {[...latestLibraries.values()].some(({ assets }) => assets.some(asset => archivePlatforms(asset.name).includes(platform.id))) && ( + {[...latestLibraries.values()].some(({ assets }) => assets.some(asset => archivePlatforms(asset.name, asset.target).includes(platform.id))) && (

{t('下方仍可下载此平台适用的库归档。', 'You can still download library archives for this platform below.')}

)}
@@ -133,15 +141,16 @@ const noData = t('暂时无法获取下载信息。', 'Download information is t
-

{t('标准库与扩展库', 'Standard and extension libraries')}

+

{t('标准库、扩展库与工具', 'Libraries and tools')}

{platforms.map(platform => { const groups = libraryGroups.map(group => ({ ...group, entries: [...latestLibraries.values()] .filter(({ release }) => componentKinds.get(release.component_id) === group.kind) .flatMap(({ release, assets }) => { - const asset = assets.find(item => archivePlatforms(item.name).includes(platform.id)); - return asset ? [{ release, asset }] : []; + return assets + .filter(item => archivePlatforms(item.name, item.target).includes(platform.id)) + .map(asset => ({ release, asset })); }) .sort((left, right) => left.release.component_id.localeCompare(right.release.component_id)), })).filter(group => group.entries.length > 0); diff --git a/src/config/release-platforms.ts b/src/config/release-platforms.ts index 4ebfe0f..8f13b2d 100644 --- a/src/config/release-platforms.ts +++ b/src/config/release-platforms.ts @@ -27,14 +27,30 @@ export function assetDescription(target: string, filename: string) { return [platform, format].filter(Boolean).join(' · '); } -/** Platform conventions for platform-independent library archives. */ -export function archivePlatforms(filename: string): readonly Platform[] { +/** + * Platforms an archive is offered for. + * + * - Platform-independent components (asset target `source`): the tar.gz follows + * the Linux/POSIX and macOS conventions, the zip follows Windows. + * - Platform-specific components (Tools): tar.gz and zip carry the same target + * binary, so the target platform applies and the format is only a packaging + * convenience (a zip is never implied to be a Windows binary). + */ +export function archivePlatforms(filename: string, target = 'source'): readonly Platform[] { const lower = filename.toLowerCase(); - return platforms.filter(platform => lower.endsWith(platform.libraryFormat)).map(platform => platform.id); + const isArchive = lower.endsWith('.tar.gz') || lower.endsWith('.zip'); + if (!isArchive) return []; + if (target !== 'source') { + const platform = releaseTargets.get(target)?.[0]; + return platform ? [platform] : []; + } + return platforms + .filter(platform => lower.endsWith(platform.libraryFormat)) + .map(platform => platform.id); } -/** Human label for the platforms a library archive is offered for. */ -export function archivePlatformLabel(filename: string, names: ReadonlyMap): string { - const ids = archivePlatforms(filename); +/** Human label for the platforms an archive is offered for. */ +export function archivePlatformLabel(filename: string, names: ReadonlyMap, target = 'source'): string { + const ids = archivePlatforms(filename, target); return ids.map(id => names.get(id) ?? id).join(' · '); } -- 2.54.1 From 31e6ba4019ef0414aeca56bcf2234be3f4b4bf30 Mon Sep 17 00:00:00 2001 From: cflmy Date: Thu, 3 Dec 2026 11:08:54 +0800 Subject: [PATCH 2/2] ci: retrigger validation for tool download changes (marqdo#110) -- 2.54.1