Skip to content

Commit

Permalink
feat: ✅ generate sub-changelogs in sync mode
Browse files Browse the repository at this point in the history
closes #42
  • Loading branch information
yjaaidi committed Jan 27, 2021
1 parent 277f59e commit 14a9b3c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 33 deletions.
4 changes: 0 additions & 4 deletions packages/semver/src/builders/version/builder.e2e.spec.ts
Expand Up @@ -11,10 +11,6 @@ import {
TestingWorkspace,
} from './testing';
import { readPackageJson } from './utils/project';
import { _enableWip } from './version';

// @todo get rid of this
_enableWip();

describe('@jscutlery/semver:version', () => {
const defaultBuilderOptions: VersionBuilderSchema = {
Expand Down
4 changes: 0 additions & 4 deletions packages/semver/src/builders/version/builder.spec.ts
Expand Up @@ -11,17 +11,13 @@ import { createFakeContext } from './testing';
import { tryBump } from './utils/try-bump';
import * as workspace from './utils/workspace';
import { getPackageFiles, getProjectRoots } from './utils/workspace';
import { _enableWip } from './version';

jest.mock('child_process');
jest.mock('@lerna/child-process');
jest.mock('standard-version', () => jest.fn());
jest.mock('standard-version/lib/lifecycles/changelog', () => jest.fn());
jest.mock('./utils/try-bump');

// @todo get rid of this
_enableWip();

describe('@jscutlery/semver:version', () => {
const mockChangelog = changelog as jest.Mock;
const mockExecFile = execFile as jest.MockedFunction<typeof execFile>;
Expand Down
41 changes: 16 additions & 25 deletions packages/semver/src/builders/version/version.ts
Expand Up @@ -9,13 +9,6 @@ import {
} from './utils/changelog';
import { getPackageFiles, getProjectRoots } from './utils/workspace';

// @todo get rid of this
let _isWip = process.env['JSCUTLERY_SEMVER_WIP'] === 'true';

export function _enableWip() {
_isWip = true;
}

export interface CommonVersionOptions {
dryRun: boolean;
newVersion: string;
Expand All @@ -35,26 +28,24 @@ export function versionWorkspace({
} & CommonVersionOptions) {
return concat(
...[
_isWip
? getProjectRoots(workspaceRoot).pipe(
switchMap((projectRoots) =>
concat(
...projectRoots
/* Don't update the workspace's changelog as it will be
* dealt with by `standardVersion`. */
.filter((projectRoot) => projectRoot !== workspaceRoot)
.map((projectRoot) =>
updateChangelog({
dryRun: options.dryRun,
preset: options.preset,
projectRoot,
newVersion: options.newVersion,
})
)
getProjectRoots(workspaceRoot).pipe(
switchMap((projectRoots) =>
concat(
...projectRoots
/* Don't update the workspace's changelog as it will be
* dealt with by `standardVersion`. */
.filter((projectRoot) => projectRoot !== workspaceRoot)
.map((projectRoot) =>
updateChangelog({
dryRun: options.dryRun,
preset: options.preset,
projectRoot,
newVersion: options.newVersion,
})
)
)
)
: [],
)
),
getPackageFiles(workspaceRoot).pipe(
switchMap((packageFiles) =>
_runStandardVersion({
Expand Down

0 comments on commit 14a9b3c

Please sign in to comment.