Simplify change log in release notes; Add separate script for updating changelog.
This commit is contained in:
parent
536beba583
commit
58c6024030
8 changed files with 115 additions and 44 deletions
|
@ -1,16 +1,17 @@
|
|||
"use strict";
|
||||
|
||||
const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
const parseVariantsData = require("../export-data/parse-variants-data");
|
||||
const parseLigationData = require("../export-data/ligation-data");
|
||||
const getCharMapAndSupportedLanguageList = require("../export-data/supported-languages");
|
||||
const execMain = require("../shared/execMain");
|
||||
|
||||
const charMapPath = process.argv[2];
|
||||
const charMapItalicPath = process.argv[3];
|
||||
const charMapObliquePath = process.argv[4];
|
||||
main().catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
execMain(main);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
async function main() {
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
const fs = require("fs-extra");
|
||||
const parseVariantsData = require("./parse-variants-data");
|
||||
const parseLigationData = require("./ligation-data");
|
||||
const getCharMapAndSupportedLanguageList = require("./supported-languages");
|
||||
const execMain = require("../shared/execMain");
|
||||
|
||||
const version = require("../../package.json").version;
|
||||
|
||||
|
@ -9,10 +12,8 @@ const charMapPath = process.argv[2];
|
|||
const charMapItalicPath = process.argv[3];
|
||||
const charMapObliquePath = process.argv[4];
|
||||
const exportPath = process.argv[5];
|
||||
main().catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
execMain(main);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
async function main() {
|
||||
|
|
49
utility/generate-change-log/index.js
Normal file
49
utility/generate-change-log/index.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
"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 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 fs.writeFile(outputPath, out.buffer);
|
||||
}
|
||||
|
||||
class Output {
|
||||
constructor() {
|
||||
this.buffer = "";
|
||||
}
|
||||
log(...s) {
|
||||
this.buffer += s.join("") + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
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]));
|
||||
|
||||
out.log(`## Modifications since version ${ModifiedSinceVersion}`);
|
||||
for (const [version, notes] of sortedFragments) {
|
||||
out.log(`\n### ${version}\n`);
|
||||
out.log(notes.trimEnd() + "\n");
|
||||
}
|
||||
}
|
|
@ -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");
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
const ejs = require("ejs");
|
||||
const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
const parseVariantsData = require("../export-data/parse-variants-data");
|
||||
const getLigationData = require("../export-data/ligation-data");
|
||||
const execMain = require("../shared/execMain");
|
||||
|
||||
const inputPath = process.argv[2];
|
||||
const outputPath = process.argv[3];
|
||||
|
||||
main().catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
execMain(main);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
10
utility/shared/execMain.js
Normal file
10
utility/shared/execMain.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
module.exports = function (main) {
|
||||
setTimeout(
|
||||
() =>
|
||||
main().catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
}),
|
||||
0
|
||||
);
|
||||
};
|
|
@ -3,23 +3,23 @@
|
|||
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 PackageJsonPath = path.join(__dirname, "../../package.json");
|
||||
|
||||
main().catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
execMain(main);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
async function main() {
|
||||
const version = await GenerateChangeList();
|
||||
const version = await GetLatestVersion();
|
||||
const packageJson = await fs.readJson(PackageJsonPath);
|
||||
packageJson.version = version;
|
||||
await fs.writeJson(PackageJsonPath, packageJson, { spaces: 2 });
|
||||
}
|
||||
|
||||
async function GenerateChangeList() {
|
||||
async function GetLatestVersion() {
|
||||
const changeFiles = await fs.readdir(ChangeFileDir);
|
||||
const versions = new Set();
|
||||
for (const file of changeFiles) {
|
||||
|
|
18
verdafile.js
18
verdafile.js
|
@ -819,6 +819,11 @@ const ChangeFileList = oracle.make(
|
|||
() => `release:change-file-list`,
|
||||
target => FileList({ under: "changes", pattern: "*.md" })(target)
|
||||
);
|
||||
|
||||
const ReleaseNotes = task(`release:release-note`, async t => {
|
||||
const [version] = await t.need(Version);
|
||||
await t.need(ReleaseNotesFile(version));
|
||||
});
|
||||
const ReleaseNotesFile = file.make(
|
||||
version => `${ARCHIVE_DIR}/release-notes-${version}.md`,
|
||||
async (t, out, version) => {
|
||||
|
@ -828,9 +833,16 @@ const ReleaseNotesFile = file.make(
|
|||
await run("node", "utility/generate-release-note/index", version, out.full);
|
||||
}
|
||||
);
|
||||
const ReleaseNotes = task(`release:release-note`, async t => {
|
||||
|
||||
const ChangeLog = task(`release:change-log`, async t => {
|
||||
await t.need(ChangeLogFile);
|
||||
});
|
||||
const ChangeLogFile = file(`CHANGELOG.md`, async (t, out) => {
|
||||
const [version] = await t.need(Version);
|
||||
await t.need(ReleaseNotesFile(version));
|
||||
await t.need(UtilScripts, de(ARCHIVE_DIR));
|
||||
const [changeFiles] = await t.need(ChangeFileList());
|
||||
await t.need(changeFiles.map(fu));
|
||||
await run("node", "utility/generate-change-log/index", version, out.full);
|
||||
});
|
||||
|
||||
phony(`clean`, async () => {
|
||||
|
@ -841,7 +853,7 @@ phony(`clean`, async () => {
|
|||
});
|
||||
phony(`release`, async target => {
|
||||
await target.need(AllTtfArchives, CollectionArchives, AllTtcArchives);
|
||||
await target.need(SampleImages, Pages, ReleaseNotes);
|
||||
await target.need(SampleImages, Pages, ReleaseNotes, ChangeLog);
|
||||
});
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue