From 4547c526e57158e0905e5b9ae5c6f49990167641 Mon Sep 17 00:00:00 2001 From: be5invis Date: Mon, 11 Mar 2024 06:57:44 -0700 Subject: [PATCH] Change archive format to ZIP --- tools/generate-release-notes.mjs | 20 +++++++++----- verdafile.mjs | 45 +++++++++++++++----------------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/tools/generate-release-notes.mjs b/tools/generate-release-notes.mjs index 6099e71bd..7dbed1f8a 100644 --- a/tools/generate-release-notes.mjs +++ b/tools/generate-release-notes.mjs @@ -13,13 +13,19 @@ async function main() { let o = ""; - o += `## Coarse-grained download links (contains all languages)\n\n`; + o += `## SuperTTC and TTC Archives (Contain all families and languages)\n\n`; - o += ` * [SuperTTC](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa-SuperTTC-${version}.7z) ([Unhinted](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa-SuperTTC-Unhinted-${version}.7z))\n`; - o += ` * [TTC](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa-TTC-${version}.7z) ([Unhinted](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa-TTC-Unhinted-${version}.7z))\n`; - o += ` * [TTF](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa-TTF-${version}.7z) ([Unhinted](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa-TTF-Unhinted-${version}.7z))\n`; + o += ` * [SuperTTC](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa-SuperTTC-${version}.zip) ([Unhinted](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa-SuperTTC-Unhinted-${version}.zip))\n`; + o += ` * [TTC](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa-TTC-${version}.zip) ([Unhinted](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa-TTC-Unhinted-${version}.zip))\n`; - o += `## Fine-grained download links\n\n`; + o += `## TTF Archives\n\n`; + o += `### Single Family, Multiple Languages Package\n\n`; + for (const family of config.familyOrder) { + o += `* [${family}](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa${family}-TTF-${version}.zip) `; + o += `([Unhinted](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa${family}-TTF-Unhinted-${version}.zip))\n`; + } + + o += `### Single Family & Language\n\n`; o += generateTableHeader(config); for (const subfamily of config.subfamilyOrder) { o += generateTableRow(config, subfamily, process.argv[2]); @@ -46,8 +52,8 @@ function generateTableRow(config, subfamily, version) { let o = `| ${subfamily} `; for (const family of config.familyOrder) { o += "| "; - o += `[TTF](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa${family}${subfamily}-TTF-${version}.7z) `; - o += `([Unhinted](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa${family}${subfamily}-TTF-Unhinted-${version}.7z)) `; + o += `[TTF](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa${family}${subfamily}-TTF-${version}.zip) `; + o += `([Unhinted](https://github.com/be5invis/Sarasa-Gothic/releases/download/v${version}/Sarasa${family}${subfamily}-TTF-Unhinted-${version}.zip)) `; } o += "|\n"; return o; diff --git a/verdafile.mjs b/verdafile.mjs index dcac930f3..84ad1874d 100644 --- a/verdafile.mjs +++ b/verdafile.mjs @@ -39,25 +39,24 @@ const Start = phony("all", async t => { const [config, version] = await t.need(Config, Version); await t.need(Ttf, Ttc); + let archiveTargets = [ + TtcArchive(`TTC`, version), + TtcArchive(`TTC-Unhinted`, version), + SuperTtcArchive(`TTC`, version), + SuperTtcArchive(`TTC-Unhinted`, version) + ]; + // Standalone archives for (const f of config.familyOrder) { - let standaloneTargets = []; + archiveTargets.push(SingleFamilyTtfArchive(`TTF`, f, version)); + archiveTargets.push(SingleFamilyTtfArchive(`TTF-Unhinted`, f, version)); for (const sf of config.subfamilyOrder) { - standaloneTargets.push(StandaloneTtfArchive(`TTF`, f, sf, version)); - standaloneTargets.push(StandaloneTtfArchive(`TTF-Unhinted`, f, sf, version)); + archiveTargets.push(StandaloneTtfArchive(`TTF`, f, sf, version)); + archiveTargets.push(StandaloneTtfArchive(`TTF-Unhinted`, f, sf, version)); } - await t.need(standaloneTargets); } - // "Everything" archives - await t.need( - TtcArchive(`TTC`, version), - TtcArchive(`TTC-Unhinted`, version), - SuperTtcArchive(`TTC`, version), - SuperTtcArchive(`TTC-Unhinted`, version), - TtfArchive(`TTF`, version), - TtfArchive(`TTF-Unhinted`, version) - ); + await t.need(archiveTargets); await run( "node", @@ -98,7 +97,7 @@ const Version = oracle("oracles::version", async t => { }); const SuperTtcArchive = file.make( - (infix, version) => `${OUT}/${PREFIX}-Super${infix}-${version}.7z`, + (infix, version) => `${OUT}/${PREFIX}-Super${infix}-${version}.zip`, async (t, out, infix) => { const [input] = await t.need(SuperTtcFile(infix)); await rm(out.full); @@ -106,7 +105,7 @@ const SuperTtcArchive = file.make( } ); const TtcArchive = file.make( - (infix, version) => `${OUT}/${PREFIX}-${infix}-${version}.7z`, + (infix, version) => `${OUT}/${PREFIX}-${infix}-${version}.zip`, async (t, out, infix) => { await t.need(TtcFontFiles(infix)); await rm(out.full); @@ -114,21 +113,19 @@ const TtcArchive = file.make( } ); -const TtfArchive = file.make( - (infix, version) => `${OUT}/${PREFIX}-${infix}-${version}.7z`, - async (t, out, infix) => { +const SingleFamilyTtfArchive = file.make( + (infix, family, version) => `${OUT}/${PREFIX}${family}-${infix}-${version}.zip`, + async (t, out, infix, family, version) => { const [config] = await t.need(Config, TtfFontFiles(infix)); await rm(out.full); - for (let j = 0; j < config.styleOrder.length; j += 1) { - const style = config.styleOrder[j]; - await SevenZipCompress(`${OUT}/${infix}`, out.full, `*-${style}.ttf`); + for (const sf of config.subfamilyOrder) { + await SevenZipCompress(`${OUT}/${infix}`, out.full, `${PREFIX}${family}${sf}-*.ttf`); } } ); - const StandaloneTtfArchive = file.make( (infix, family, subfamily, version) => - `${OUT}/${PREFIX}${family}${subfamily}-${infix}-${version}.7z`, + `${OUT}/${PREFIX}${family}${subfamily}-${infix}-${version}.zip`, async (t, out, infix, family, subfamily, version) => { await t.need(Config, TtfFontFiles(infix)); await rm(out.full); @@ -139,7 +136,7 @@ const StandaloneTtfArchive = file.make( function SevenZipCompress(dir, target, ...inputs) { return cd(dir).run( [SEVEN_ZIP, `a`], - [`-t7z`, `-mmt=on`, `-mx=9`], + [`-tzip`, `-mmt=on`, `-mx=9`], [path.relative(dir, target), ...inputs] ); }