From 24e84b9c9d8b4729313bbe25cb6bc4ca1d504409 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Sat, 3 Oct 2026 09:56:49 +0100 Subject: [PATCH] fix(deps): hold the conventional commits preset at version 9 Version 10 of the preset needs conventional-changelog-writer 9, while the newest semantic-release notes generator still loads writer 8, so every release failed while rendering notes. A test now renders release notes through the generator and the preset, which is where the mismatch shows up before a release runs. --- package.json | 3 +- pnpm-lock.yaml | 18 +++++++++-- src/release-notes.integration.test.ts | 30 +++++++++++++++++++ src/test-support/release-notes-generator.d.ts | 17 +++++++++++ 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 src/release-notes.integration.test.ts create mode 100644 src/test-support/release-notes-generator.d.ts diff --git a/package.json b/package.json index b3eb80d..87dbaaf 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "@exadev/eslint-config": "2.35.0", "@semantic-release/changelog": "^7.0.0", "@semantic-release/git": "^11.0.1", + "@semantic-release/release-notes-generator": "14.1.1", "@types/jsdom": "^30.0.0", "@types/node": "^26.6.3", "@types/semver": "7.8.0", @@ -48,7 +49,7 @@ "@typescript/native": "npm:typescript@^7.0.2", "@vitest/coverage-v8": "^5.0.2", "commitizen": "^4.3.2", - "conventional-changelog-conventionalcommits": "^10.4.0", + "conventional-changelog-conventionalcommits": "^9.3.1", "cz-conventional-changelog": "^3.3.0", "eslint": "^10.11.0", "eslint-config-prettier": "^10.1.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5f202e0..0a2d78a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -90,6 +90,9 @@ importers: "@semantic-release/git": specifier: ^11.0.1 version: 11.0.1(semantic-release@25.0.9(@typescript/typescript6@6.0.2)(supports-color@7.2.0))(supports-color@7.2.0) + "@semantic-release/release-notes-generator": + specifier: 14.1.1 + version: 14.1.1(semantic-release@25.0.9(@typescript/typescript6@6.0.2)(supports-color@7.2.0))(supports-color@7.2.0) "@types/jsdom": specifier: ^30.0.0 version: 30.0.0 @@ -115,8 +118,8 @@ importers: specifier: ^4.3.2 version: 4.3.2(@types/node@26.6.3)(@typescript/typescript6@6.0.2) conventional-changelog-conventionalcommits: - specifier: ^10.4.0 - version: 10.4.0 + specifier: ^9.3.1 + version: 9.3.1 cz-conventional-changelog: specifier: ^3.3.0 version: 3.3.0(@types/node@26.6.3)(@typescript/typescript6@6.0.2) @@ -3041,6 +3044,13 @@ packages: } engines: { node: ">=22" } + conventional-changelog-conventionalcommits@9.3.1: + resolution: + { + integrity: sha512-dTYtpIacRpcZgrvBYvBfArMmK2xvIpv2TaxM0/ZI5CBtNUzvF2x0t15HsbRABWprS6UPmvj+PzHVjSx4qAVKyw==, + } + engines: { node: ">=18" } + conventional-changelog-writer@8.4.0: resolution: { @@ -8733,6 +8743,10 @@ snapshots: dependencies: "@conventional-changelog/template": 1.4.0 + conventional-changelog-conventionalcommits@9.3.1: + dependencies: + compare-func: 2.0.0 + conventional-changelog-writer@8.4.0: dependencies: "@simple-libs/stream-utils": 1.2.0 diff --git a/src/release-notes.integration.test.ts b/src/release-notes.integration.test.ts new file mode 100644 index 0000000..bffddaf --- /dev/null +++ b/src/release-notes.integration.test.ts @@ -0,0 +1,30 @@ +import { describe, expect, it } from "vitest"; +import { generateNotes } from "@semantic-release/release-notes-generator"; + +/** + * Renders release notes through the same preset semantic-release is configured with. The preset + * and the changelog writer that semantic-release's notes generator loads have to agree on a major + * version, and a mismatch only otherwise shows up when a release runs. + */ +describe("release notes", () => { + it("renders a release with the configured conventional commits preset", async () => { + const notes = await generateNotes( + { preset: "conventionalcommits" }, + { + cwd: process.cwd(), + options: { repositoryUrl: "https://github.com/ExaDev/markmv.git" }, + lastRelease: { gitTag: "v1.0.0" }, + nextRelease: { gitTag: "v1.1.0", version: "1.1.0" }, + commits: [ + { + hash: "abc1234abc1234abc1234abc1234abc1234abc12", + message: "feat(cli): start the servers with markmv api", + committerDate: new Date().toISOString(), + }, + ], + }, + ); + + expect(notes).toContain("start the servers with markmv api"); + }); +}); diff --git a/src/test-support/release-notes-generator.d.ts b/src/test-support/release-notes-generator.d.ts new file mode 100644 index 0000000..46698b5 --- /dev/null +++ b/src/test-support/release-notes-generator.d.ts @@ -0,0 +1,17 @@ +/** The part of semantic-release's notes generator that the release notes test calls; the package ships no declarations. */ +declare module "@semantic-release/release-notes-generator" { + export function generateNotes( + pluginConfig: { preset: string }, + context: { + cwd: string; + options: { repositoryUrl: string }; + lastRelease: { gitTag: string }; + nextRelease: { gitTag: string; version: string }; + commits: readonly { + hash: string; + message: string; + committerDate: string; + }[]; + }, + ): Promise; +}