From 293af06958d806bcb5f467f7e499ef237599507e Mon Sep 17 00:00:00 2001 From: Edouard Bozon Date: Mon, 10 Jan 2022 09:55:00 +0100 Subject: [PATCH] =?UTF-8?q?fix(semver):=20=F0=9F=90=9E=20use=20`--skipProj?= =?UTF-8?q?ectChangelog`=20with=20independent=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../semver/src/executors/version/index.spec.ts | 14 ++++++++++++++ packages/semver/src/executors/version/index.ts | 2 +- packages/semver/src/executors/version/version.ts | 9 ++++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/packages/semver/src/executors/version/index.spec.ts b/packages/semver/src/executors/version/index.spec.ts index a477729c4..3ebc459e6 100644 --- a/packages/semver/src/executors/version/index.spec.ts +++ b/packages/semver/src/executors/version/index.spec.ts @@ -212,6 +212,20 @@ describe('@jscutlery/semver:version', () => { ); expect(standardVersion).not.toBeCalled(); }); + + it('should skip changelog generation with --skipProjectChangelog', async () => { + const { success } = await version( + { ...options, skipProjectChangelog: true }, + context + ); + + expect(success).toBe(true); + expect(standardVersion).toBeCalledWith( + expect.objectContaining({ + skip: { changelog: true }, + }) + ); + }); }); describe('Sync versions', () => { diff --git a/packages/semver/src/executors/version/index.ts b/packages/semver/src/executors/version/index.ts index eae540c26..9b29221d2 100644 --- a/packages/semver/src/executors/version/index.ts +++ b/packages/semver/src/executors/version/index.ts @@ -92,6 +92,7 @@ export default async function version( changelogHeader, commitMessageFormat, projectName, + skipProjectChangelog, }; const runStandardVersion$ = defer(() => @@ -99,7 +100,6 @@ export default async function version( ? versionWorkspace({ ...options, skipRootChangelog, - skipProjectChangelog, workspaceRoot, }) : versionProject(options) diff --git a/packages/semver/src/executors/version/version.ts b/packages/semver/src/executors/version/version.ts index c158f74af..94542c284 100644 --- a/packages/semver/src/executors/version/version.ts +++ b/packages/semver/src/executors/version/version.ts @@ -19,6 +19,7 @@ export interface CommonVersionOptions { changelogHeader?: string; commitMessageFormat?: string; projectName: string; + skipProjectChangelog: boolean; } export function versionWorkspace({ @@ -27,7 +28,6 @@ export function versionWorkspace({ ...options }: { skipRootChangelog: boolean; - skipProjectChangelog: boolean; workspaceRoot: string; } & CommonVersionOptions) { return getProjectRoots(workspaceRoot).pipe( @@ -60,7 +60,7 @@ export function versionWorkspace({ export function versionProject(options: CommonVersionOptions) { return _runStandardVersion({ bumpFiles: [resolve(options.projectRoot, 'package.json')], - skipChangelog: false, + skipChangelog: options.skipProjectChangelog, ...options, }); } @@ -119,7 +119,6 @@ export function _createCommitMessageFormatConfig({ : {}; } - /* istanbul ignore next */ export async function _runStandardVersion({ bumpFiles, @@ -132,11 +131,11 @@ export async function _runStandardVersion({ skipChangelog, projectName, commitMessageFormat, - changelogHeader + changelogHeader, }: { bumpFiles: string[]; skipChangelog: boolean; -} & CommonVersionOptions) { +} & Omit) { await standardVersion({ bumpFiles, /* Make sure that we commit the manually generated changelogs that