From 50fb9a2ed105ed18b4a24b915276ad7def59cfc0 Mon Sep 17 00:00:00 2001 From: Jack Westbrook Date: Mon, 22 Jan 2024 09:19:36 +0100 Subject: [PATCH 1/2] fix(npm): gh release publishing should set latest --- plugins/npm/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/npm/src/index.ts b/plugins/npm/src/index.ts index e56dfe3d5..ae5452fe9 100644 --- a/plugins/npm/src/index.ts +++ b/plugins/npm/src/index.ts @@ -1580,7 +1580,7 @@ export default class NPMPlugin implements IPlugin { auto.logger.log.info(`Using release notes:\n${releaseNotes}`); // 2. make a release for just that package - return auto.git?.publish(releaseNotes, tag, options.isPrerelease); + return auto.git?.publish(releaseNotes, tag, options.isPrerelease, undefined, !auto.inOldVersionBranch()); }) ); From fce0e96f1bc2a0ea61b9555427170d86249eeae9 Mon Sep 17 00:00:00 2001 From: Jack Westbrook Date: Wed, 24 Jan 2024 10:05:18 +0100 Subject: [PATCH 2/2] test(npm): update makeRelease with inOldVersionBranch and fix ts error --- plugins/npm/__tests__/npm.test.ts | 10 ++++++++-- plugins/npm/src/index.ts | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/npm/__tests__/npm.test.ts b/plugins/npm/__tests__/npm.test.ts index 266417a7a..1518c08ab 100644 --- a/plugins/npm/__tests__/npm.test.ts +++ b/plugins/npm/__tests__/npm.test.ts @@ -1650,6 +1650,7 @@ describe("makeRelease", () => { logger: dummyLog(), prefixRelease: (str) => str, git: { publish } as any, + inOldVersionBranch: (bool) => bool, release: { makeChangelog: () => ({ generateReleaseNotes: (commits: IExtendedCommit[]) => @@ -1661,6 +1662,7 @@ describe("makeRelease", () => { await hooks.makeRelease.promise({ newVersion: "0.1.2", from: "", + to: "", isPrerelease: false, fullReleaseNotes: "", commits: [ @@ -1684,12 +1686,16 @@ describe("makeRelease", () => { expect(publish).toHaveBeenCalledWith( "update package 1", "@packages/a", - false + false, + undefined, + true ); expect(publish).toHaveBeenCalledWith( "update package 2", "@packages/b", - false + false, + undefined, + true ); }); }); diff --git a/plugins/npm/src/index.ts b/plugins/npm/src/index.ts index ae5452fe9..6f6447525 100644 --- a/plugins/npm/src/index.ts +++ b/plugins/npm/src/index.ts @@ -1580,7 +1580,13 @@ export default class NPMPlugin implements IPlugin { auto.logger.log.info(`Using release notes:\n${releaseNotes}`); // 2. make a release for just that package - return auto.git?.publish(releaseNotes, tag, options.isPrerelease, undefined, !auto.inOldVersionBranch()); + return auto.git?.publish( + releaseNotes, + tag, + options.isPrerelease, + undefined, + !auto.inOldVersionBranch() + ); }) );