feat: add a plugin sdk changelog and tag sdk releases, release 1.0.2

This commit is contained in:
LukeGus committed 2026-10-07 20:09:42 -05:00
1 parent ea678c5602
commit 64eafa0032
7 files changed
+113 -35

No files matched your search

+16 -4
View File
@@ -9,11 +9,23 @@ if (!fs.existsSync(sdk)) {
process.exit(1);
}
const { parseChangelog } = require(sdk);
const { problems } = parseChangelog(
fs.readFileSync(path.join(root, "CHANGELOG.md"), "utf8"),
const { parseChangelog, validateChangelog } = require(sdk);
const read = (file) => fs.readFileSync(path.join(root, file), "utf8");
const problems = parseChangelog(read("CHANGELOG.md")).problems.map(
(problem) => `CHANGELOG.md: ${problem}`,
);
// The SDK is published on its own, so its newest release has to be the package version.
const sdkVersion = JSON.parse(read("packages/plugin-sdk/package.json")).version;
problems.push(
...validateChangelog(
read("packages/plugin-sdk/CHANGELOG.md"),
sdkVersion,
).map((problem) => `packages/plugin-sdk/CHANGELOG.md: ${problem}`),
);
if (problems.length > 0) {
for (const problem of problems) console.error(` CHANGELOG.md: ${problem}`);
for (const problem of problems) console.error(` ${problem}`);
process.exit(1);
}
+13 -14
View File
@@ -9,11 +9,6 @@ import {
const FILE = [
"# Changelog",
"",
"## Unreleased",
"",
"### Fixed",
"- A bug not shipped yet",
"",
"## 1.1.0 - 2026-10-06",
"",
"Second release.",
@@ -34,12 +29,9 @@ const FILE = [
].join("\n");
describe("parseChangelog", () => {
it("reads releases, summaries, sections and unreleased changes", () => {
it("reads releases, summaries and sections", () => {
const { changelog, problems } = parseChangelog(FILE);
expect(problems).toEqual([]);
expect(changelog.unreleased).toEqual([
{ type: "fixed", text: "A bug not shipped yet" },
]);
expect(changelog.releases).toEqual([
{
version: "1.1.0",
@@ -104,12 +96,19 @@ describe("parseChangelog", () => {
);
});
it("flags a release with no changes and Unreleased out of place", () => {
const { problems } = parseChangelog(
"## 1.0.0\n\nJust a summary.\n\n## Unreleased\n### Added\n- x\n",
);
it("flags a release with no changes", () => {
const { problems } = parseChangelog("## 1.0.0\n\nJust a summary.\n");
expect(problems).toContain("1.0.0 has no changes listed");
expect(problems).toContain('"## Unreleased" has to come first');
});
it("flags an Unreleased section", () => {
const { changelog, problems } = parseChangelog(
"## Unreleased\n### Added\n- x\n\n## 1.0.0\n### Added\n- y\n",
);
expect(problems).toEqual([
'line 1: drop "## Unreleased", notes go under the version they ship in',
]);
expect(changelog.releases.map((r) => r.version)).toEqual(["1.0.0"]);
});
it("ignores headings inside code fences", () => {