Adds a deterministic changelog-archive split so scripts/release.mjs stops regenerating one ever-growing root CHANGELOG.md and instead keeps only current release notes at the root while durably archiving pre-0.50.0 history. - Add scripts/lib/changelog-archive.mjs with partitionVersionsByCutoff (splits a version-ordered list at the 0.50.0 cutoff, preserving order and treating non-parseable keys as archived) and archivePointerLine (renders the "older releases" pointer appended to the current changelog). - Rework scripts/release.mjs's syncRootChangelog to build CHANGELOG.md (current versions + archive pointer) and a new CHANGELOG-archive.md (versions before 0.50.0) via a shared buildRootChangelogLines/normalizeChangelogLines helper instead of one monolithic file. - Add scripts/__tests__/changelog-archive.test.mjs covering cutoff partitioning, boundary/patch handling, non-parseable keys, custom cutoffs, and the archive pointer text. - Regenerate CHANGELOG.md (now only 0.50.0+) and add CHANGELOG-archive.md containing the pre-0.50.0 history moved out of the root file. Files changed: CHANGELOG-archive.md | 10882 +++++++++++++++++++++++ CHANGELOG.md | 11717 ++----------------------- scripts/__tests__/changelog-archive.test.mjs | 58 + scripts/lib/changelog-archive.mjs | 56 + scripts/release.mjs | 49 +- 5 files changed, 11710 insertions(+), 11052 deletions(-) Fusion-Task-Id: FN-7875 Fusion-Task-Lineage: 220e6aa1-54fb-4800-a86e-6d8d21f6bf18 Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
59 lines
1.7 KiB
JavaScript
59 lines
1.7 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import {
|
|
archivePointerLine,
|
|
CHANGELOG_ARCHIVE_CUTOFF,
|
|
CHANGELOG_ARCHIVE_FILE,
|
|
partitionVersionsByCutoff,
|
|
} from "../lib/changelog-archive.mjs";
|
|
|
|
test("partitions versions at the pre-0.50 archive cutoff", () => {
|
|
assert.deepEqual(
|
|
partitionVersionsByCutoff(["0.58.0", "0.50.0", "0.49.0", "0.11.1"]),
|
|
{
|
|
current: ["0.58.0", "0.50.0"],
|
|
archived: ["0.49.0", "0.11.1"],
|
|
},
|
|
);
|
|
});
|
|
|
|
test("keeps the 0.50.0 boundary and newer patch versions current", () => {
|
|
const partitioned = partitionVersionsByCutoff(["0.53.1", "0.50.0", "0.49.0"]);
|
|
|
|
assert.deepEqual(partitioned.current, ["0.53.1", "0.50.0"]);
|
|
assert.deepEqual(partitioned.archived, ["0.49.0"]);
|
|
});
|
|
|
|
test("preserves input order and archives non-parseable version keys", () => {
|
|
const partitioned = partitionVersionsByCutoff([
|
|
"0.51.0",
|
|
"legacy notes",
|
|
"0.50.0 (pre-release, unpublished)",
|
|
"0.49.9",
|
|
"0.53.0",
|
|
]);
|
|
|
|
assert.deepEqual(partitioned.current, [
|
|
"0.51.0",
|
|
"0.50.0 (pre-release, unpublished)",
|
|
"0.53.0",
|
|
]);
|
|
assert.deepEqual(partitioned.archived, ["legacy notes", "0.49.9"]);
|
|
});
|
|
|
|
test("supports a custom cutoff with release.mjs semver-ish parsing", () => {
|
|
assert.deepEqual(partitionVersionsByCutoff(["1.2.0", "1.1.9", "not semver"], "1.2.0"), {
|
|
current: ["1.2.0"],
|
|
archived: ["1.1.9", "not semver"],
|
|
});
|
|
});
|
|
|
|
test("archive pointer references the archive file and cutoff", () => {
|
|
const pointer = archivePointerLine();
|
|
|
|
assert.ok(pointer.includes(CHANGELOG_ARCHIVE_FILE));
|
|
assert.ok(pointer.includes(CHANGELOG_ARCHIVE_CUTOFF));
|
|
assert.match(pointer, /\.\/CHANGELOG-archive\.md/);
|
|
});
|