mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-10 18:35:17 +00:00
Every release entry in CHANGELOG.md now leads with highlights: an unheaded list above the first `###`. The app's What's new sheet, the website changelog and the GitHub release body show the highlights and fold the sections, the full record, behind one control. An entry without highlights keeps its sections in view. docs/release.md carries the writing rules. Installed apps fetch CHANGELOG.md from main and parse it with the parser they shipped with, so the two heading rules are a compatibility surface: `##` starts a release, `###` starts a section, and headings inside fenced code are text. The app, website and release-script parsers now split an entry the same way and each runs the shared cases in scripts/test-support/changelog-structure.json. The release-script tests, which no CI job ran before, are part of "Validate CI contracts". Adds the 0.16.0-beta.1 entry (en and zh-CN) ahead of the release.
42 lines
1.6 KiB
JavaScript
42 lines
1.6 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
import { parseChangelogEntries, splitChangelogHighlights } from "./changelog-utils.mjs";
|
|
|
|
// The cases the app, the website and the release scripts must all split the same way.
|
|
const structureCases = JSON.parse(
|
|
readFileSync(new URL("./test-support/changelog-structure.json", import.meta.url), "utf8"),
|
|
);
|
|
|
|
for (const lineEnding of ["\n", "\r\n"]) {
|
|
test(`splits the shared cases with ${JSON.stringify(lineEnding)} line endings`, () => {
|
|
const entries = parseChangelogEntries(structureCases.document.join(lineEnding));
|
|
|
|
assert.deepEqual(
|
|
entries.map((entry) => {
|
|
const { highlightLines, sectionLines } = splitChangelogHighlights(entry.bodyLines);
|
|
return {
|
|
version: entry.version,
|
|
date: entry.date,
|
|
highlights: highlightLines,
|
|
sections: sectionLines,
|
|
};
|
|
}),
|
|
structureCases.releases.map((release) => ({
|
|
version: release.version,
|
|
date: release.date,
|
|
highlights: release.highlights,
|
|
sections: release.sections,
|
|
})),
|
|
);
|
|
});
|
|
}
|
|
|
|
test("finds an entry for every release heading line in the repository's CHANGELOG.md", () => {
|
|
for (const file of ["CHANGELOG.md", "CHANGELOG.zh-CN.md"]) {
|
|
const changelog = readFileSync(new URL(`../${file}`, import.meta.url), "utf8");
|
|
const headingLines = changelog.split("\n").filter((line) => line.startsWith("## "));
|
|
assert.equal(parseChangelogEntries(changelog).length, headingLines.length, file);
|
|
}
|
|
});
|