mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 23:25:24 +00:00
feat: changelog.md release notes, v tags, plugin release notes and videos
This commit is contained in:
1 parent
b9dd3488a5
commit
9bc2be721b
45 files changed
+1462
-816
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { readManifest } from "../lib/plugin-dir.mjs";
|
||||
import { loadSdkModule } from "./validate.mjs";
|
||||
|
||||
/**
|
||||
* Prints one version's notes from CHANGELOG.md, the manifest version unless
|
||||
* --version says otherwise. The release workflow uses it as the release body.
|
||||
*/
|
||||
export async function changelog({ cwd, args = [] }) {
|
||||
const index = args.indexOf("--version");
|
||||
const version =
|
||||
index === -1 ? readManifest(cwd).version : args[index + 1] || null;
|
||||
if (!version) throw new Error("--version needs a value");
|
||||
|
||||
const file = path.join(cwd, "CHANGELOG.md");
|
||||
if (!fs.existsSync(file)) throw new Error("There is no CHANGELOG.md");
|
||||
|
||||
const { changelogSection } = await loadSdkModule("changelog");
|
||||
const section = changelogSection(fs.readFileSync(file, "utf8"), version);
|
||||
if (!section) {
|
||||
throw new Error(`CHANGELOG.md has no notes for ${version}`);
|
||||
}
|
||||
process.stdout.write(`${section}\n`);
|
||||
}
|
||||
Reference in new issue
Block a user