Skip to content

Commit

Permalink
fix(semver): 🐞 use --skipProjectChangelog with independent mode
Browse files Browse the repository at this point in the history
  • Loading branch information
edbzn committed Jan 10, 2022
1 parent f483776 commit 293af06
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
14 changes: 14 additions & 0 deletions packages/semver/src/executors/version/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/semver/src/executors/version/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ export default async function version(
changelogHeader,
commitMessageFormat,
projectName,
skipProjectChangelog,
};

const runStandardVersion$ = defer(() =>
syncVersions
? versionWorkspace({
...options,
skipRootChangelog,
skipProjectChangelog,
workspaceRoot,
})
: versionProject(options)
Expand Down
9 changes: 4 additions & 5 deletions packages/semver/src/executors/version/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface CommonVersionOptions {
changelogHeader?: string;
commitMessageFormat?: string;
projectName: string;
skipProjectChangelog: boolean;
}

export function versionWorkspace({
Expand All @@ -27,7 +28,6 @@ export function versionWorkspace({
...options
}: {
skipRootChangelog: boolean;
skipProjectChangelog: boolean;
workspaceRoot: string;
} & CommonVersionOptions) {
return getProjectRoots(workspaceRoot).pipe(
Expand Down Expand Up @@ -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,
});
}
Expand Down Expand Up @@ -119,7 +119,6 @@ export function _createCommitMessageFormatConfig({
: {};
}


/* istanbul ignore next */
export async function _runStandardVersion({
bumpFiles,
Expand All @@ -132,11 +131,11 @@ export async function _runStandardVersion({
skipChangelog,
projectName,
commitMessageFormat,
changelogHeader
changelogHeader,
}: {
bumpFiles: string[];
skipChangelog: boolean;
} & CommonVersionOptions) {
} & Omit<CommonVersionOptions, 'skipProjectChangelog'>) {
await standardVersion({
bumpFiles,
/* Make sure that we commit the manually generated changelogs that
Expand Down

0 comments on commit 293af06

Please sign in to comment.