Simplify change log in release notes; Add separate script for updating changelog.

This commit is contained in:
be5invis 2020-10-23 20:49:52 -07:00
parent 536beba583
commit 58c6024030
8 changed files with 115 additions and 44 deletions

View file

@ -3,12 +3,28 @@
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 ModifiedSinceVersion = "2.x";
const Version = process.argv[2];
const outputPath = process.argv[3];
execMain(main);
///////////////////////////////////////////////////////////////////////////////////////////////////
async function main() {
const out = new Output();
await GenerateChangeList(out);
await CopyMarkdown(out, "packages-desc.md");
await GeneratePackageList(out);
await CopyMarkdown(out, "package-reorg.md");
await fs.ensureDir(path.join(__dirname, `../../release-archives/`));
await fs.writeFile(outputPath, out.buffer);
}
class Output {
constructor() {
this.buffer = "";
@ -18,23 +34,6 @@ class Output {
}
}
async function main() {
const out = new Output();
await CopyMarkdown(out, "packages-desc.md");
await GeneratePackageList(out);
await CopyMarkdown(out, "package-reorg.md");
await GenerateChangeList(out);
await fs.ensureDir(path.join(__dirname, `../../release-archives/`));
await fs.writeFile(outputPath, out.buffer);
}
main().catch(e => {
console.error(e);
process.exit(1);
});
///////////////////////////////////////////////////////////////////////////////////////////////////
// Copy Markdown
@ -61,11 +60,10 @@ async function GenerateChangeList(out) {
}
const sortedFragments = Array.from(fragments).sort((a, b) => semver.compare(b[0], a[0]));
out.log(`## Modifications since version ${ModifiedSinceVersion}`);
for (const [version, notes] of sortedFragments) {
out.log(` * **${version}**`);
out.log((notes.trimEnd() + "\n").replace(/^/gm, " "));
}
const [version, notes] = sortedFragments[0];
out.log(``);
out.log(`## Changes of version ${version}`);
out.log(notes.trimEnd() + "\n");
}
///////////////////////////////////////////////////////////////////////////////////////////////////