mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 14:20:44 +00:00
fix(release): align beta plugin changelog sections
This commit is contained in:
@@ -68,6 +68,10 @@ function syncBuildOpenClawVersion(pkg: PackageJson, targetVersion: string): bool
|
||||
return true;
|
||||
}
|
||||
|
||||
function changelogVersionForPackageVersion(version: string): string {
|
||||
return version.replace(/-beta\.\d+$/u, "");
|
||||
}
|
||||
|
||||
function ensureChangelogEntry(changelogPath: string, version: string, write: boolean): boolean {
|
||||
if (!existsSync(changelogPath)) {
|
||||
return false;
|
||||
@@ -127,7 +131,8 @@ export function syncPluginVersions(
|
||||
}
|
||||
|
||||
const changelogPath = join(extensionsDir, dir.name, "CHANGELOG.md");
|
||||
if (ensureChangelogEntry(changelogPath, targetVersion, write)) {
|
||||
const changelogVersion = changelogVersionForPackageVersion(targetVersion);
|
||||
if (ensureChangelogEntry(changelogPath, changelogVersion, write)) {
|
||||
changelogged.push(pkg.name);
|
||||
}
|
||||
|
||||
|
||||
@@ -112,4 +112,34 @@ describe("syncPluginVersions", () => {
|
||||
expect(unchangedPackage.peerDependencies?.openclaw).toBe(">=2026.4.1");
|
||||
expect(unchangedPackage.openclaw?.compat?.pluginApi).toBe(">=2026.4.1");
|
||||
});
|
||||
|
||||
it("uses the base release version for beta changelog entries", () => {
|
||||
const rootDir = makeTempDir(tempDirs, "openclaw-sync-plugin-versions-beta-changelog-");
|
||||
|
||||
writeJson(path.join(rootDir, "package.json"), {
|
||||
name: "openclaw",
|
||||
version: "2026.5.3-beta.1",
|
||||
});
|
||||
writeJson(path.join(rootDir, "extensions/matrix/package.json"), {
|
||||
name: "@openclaw/matrix",
|
||||
version: "2026.5.3-beta.1",
|
||||
});
|
||||
fs.mkdirSync(path.join(rootDir, "extensions/matrix"), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(rootDir, "extensions/matrix/CHANGELOG.md"),
|
||||
"# Changelog\n\n## 2026.5.2\n\n### Changes\n\n- Previous release.\n",
|
||||
"utf8",
|
||||
);
|
||||
|
||||
const summary = syncPluginVersions(rootDir);
|
||||
const changelog = fs.readFileSync(path.join(rootDir, "extensions/matrix/CHANGELOG.md"), "utf8");
|
||||
|
||||
expect(summary.changelogged).toEqual(["@openclaw/matrix"]);
|
||||
expect(changelog).toContain("## 2026.5.3\n\n### Changes\n- Version alignment");
|
||||
expect(changelog).not.toContain("## 2026.5.3-beta.1");
|
||||
|
||||
const checkSummary = syncPluginVersions(rootDir, { write: false });
|
||||
|
||||
expect(checkSummary.changelogged).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user