Move around files so the repo will be organized as a monorepo.

This commit is contained in:
be5invis 2023-12-03 02:49:33 -08:00
parent 65d1880a84
commit 08c69f0fd3
365 changed files with 1477 additions and 1262 deletions

View file

@ -0,0 +1,52 @@
import fs from "fs";
import path from "path";
import url from "url";
import SemVer from "semver";
import { MdCol } from "./md-format-tools.mjs";
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
const ChangesFileDir = path.join(__dirname, "../../../changes");
///////////////////////////////////////////////////////////////////////////////////////////////////
// RELEASE NOTE
async function GenerateChangeList(argv, out) {
const changeFiles = await fs.promises.readdir(ChangesFileDir);
const fragments = new Map();
for (const file of changeFiles) {
const filePath = path.join(ChangesFileDir, file);
const fileParts = path.parse(filePath);
if (fileParts.ext !== ".md") continue;
if (!SemVer.valid(fileParts.name) || SemVer.lt(argv.version, fileParts.name)) continue;
fragments.set(fileParts.name, await fs.promises.readFile(filePath, "utf8"));
}
const sortedFragments = Array.from(fragments).sort((a, b) => SemVer.compare(b[0], a[0]));
const latestMajor = SemVer.major(sortedFragments[0][0]);
const latestMinor = SemVer.minor(sortedFragments[0][0]);
for (const [version, notes] of sortedFragments) {
const currentMajor = SemVer.major(version);
const currentMinor = SemVer.minor(version);
if (latestMajor !== currentMajor || latestMinor !== currentMinor) continue;
out.log(``);
out.log(`## Changes of version ${version}`);
out.log(notes.trimEnd() + "\n");
}
}
export default async function main(argv) {
const out = new MdCol("Release-Note");
let baseUrl = `https://github.com/be5invis/Iosevka/blob/v${argv.version}/doc`;
await GenerateChangeList(argv, out);
out.log(
`<table>` +
`<tr><td align="center"><h1>` +
`<a href="${baseUrl}/PACKAGE-LIST.md">View package list</a>` +
`</h1></td></tr>` +
`<tr><td align="center">` +
`<a href="${baseUrl}/packages-sha.txt">Package hashes (SHA-256)</a>` +
`</td></tr>` +
`</table>`
);
await fs.promises.writeFile(argv.outputPath, out.data);
}