"use strict"; const path = require("path"); const fs = require("fs-extra"); const semver = require("semver"); const execMain = require("../shared/execMain"); const ChangeFileDir = path.join(__dirname, "../../changes"); const Version = process.argv[2]; const releasePackagesJsonPath = process.argv[3]; const outputPath = process.argv[4]; execMain(main); /////////////////////////////////////////////////////////////////////////////////////////////////// async function main() { const out = new Output(); await GenerateChangeList(out); await CopyMarkdown(out, "packages-desc.md"); await GeneratePackageList(out); await fs.ensureDir(path.join(__dirname, `../../release-archives/`)); await fs.writeFile(outputPath, out.buffer); } class Output { constructor() { this.buffer = ""; } log(...s) { this.buffer += s.join("") + "\n"; } } /////////////////////////////////////////////////////////////////////////////////////////////////// // Copy Markdown async function CopyMarkdown(out, name) { const content = await fs.readFile( path.resolve(__dirname, `release-note-fragments/${name}`), "utf8" ); out.log(content); } /////////////////////////////////////////////////////////////////////////////////////////////////// // CHANGE LIST async function GenerateChangeList(out) { const changeFiles = await fs.readdir(ChangeFileDir); const fragments = new Map(); for (const file of changeFiles) { const filePath = path.join(ChangeFileDir, file); const fileParts = path.parse(filePath); if (fileParts.ext !== ".md") continue; if (!semver.valid(fileParts.name) || semver.lt(Version, fileParts.name)) continue; fragments.set(fileParts.name, await fs.readFile(filePath, "utf8")); } const sortedFragments = Array.from(fragments).sort((a, b) => semver.compare(b[0], a[0])); const [version, notes] = sortedFragments[0]; out.log(``); out.log(`## Changes of version ${version}`); out.log(notes.trimEnd() + "\n"); } /////////////////////////////////////////////////////////////////////////////////////////////////// // PACKAGE LIST const Spacings = { // spacingDesc, ligation, spacingNameSuffix type: ["Default", true], term: ["Terminal", true], fixed: ["Fixed", false] }; const imagePrefix = `https://raw.githubusercontent.com/be5invis/Iosevka/v${Version}/images`; async function GeneratePackageList(out) { const pkgShapesData = await fs.readJson(releasePackagesJsonPath); out.log(`
📦 ${familyName} — ${desc} | `, `TTC | `, `||||
└ Sub-packages | `, `Spacing | `, `Ligatures | `, `Downloads | `, `||
${leader} ${noBreak(subGr.family)} | `, `${spacingDesc} | `, `${flag(ligation)} | `, `${createLink("TTF", "ttf")} | `, `${createLink("Unhinted", "ttf-unhinted")} | `, `${createLink("WebFont", "webfont")} | `, `
${img} | `, `|||||