Skip to content

Commit 8ec3b14

Browse files
committed
remove bump exception
1 parent b40714f commit 8ec3b14

4 files changed

Lines changed: 6 additions & 30 deletions

File tree

src/__tests__/publish/getPackagesToPublish.test.ts

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { describe, it, expect } from '@jest/globals';
22
import { makePackageInfos, type PartialPackageInfos } from '../../__fixtures__/packageInfos';
33
import { getPackagesToPublish } from '../../publish/getPackagesToPublish';
44
import { initMockLogs } from '../../__fixtures__/mockLogs';
5-
import type { BeachballOptions } from '../../types/BeachballOptions';
65

76
type PartialBumpInfo = Parameters<typeof getPackagesToPublish>[0];
87

@@ -14,12 +13,10 @@ describe('getPackagesToPublish', () => {
1413
* - all packages are in scope and modified
1514
* - all modified packages have changeType: 'patch'
1615
* - logging enabled
17-
* - `bump: true`
1816
*/
1917
function getPackagesToPublishWrapper(
2018
partialBumpInfo: { packageInfos: PartialPackageInfos } & Partial<Omit<PartialBumpInfo, 'packageInfos'>>,
21-
options?: Pick<BeachballOptions, 'bump'>,
22-
params?: Parameters<typeof getPackagesToPublish>[2]
19+
params?: Parameters<typeof getPackagesToPublish>[1]
2320
) {
2421
const { packageInfos, modifiedPackages = new Set(Object.keys(packageInfos)), ...rest } = partialBumpInfo;
2522
const bumpInfo: PartialBumpInfo = {
@@ -29,7 +26,7 @@ describe('getPackagesToPublish', () => {
2926
calculatedChangeTypes: Object.fromEntries([...modifiedPackages].map(pkg => [pkg, 'patch'])),
3027
...rest,
3128
};
32-
return getPackagesToPublish(bumpInfo, { bump: true, ...options }, { logSkipped: true, ...params });
29+
return getPackagesToPublish(bumpInfo, { logSkipped: true, ...params });
3330
}
3431

3532
it('returns empty if no modified packages', () => {
@@ -113,7 +110,7 @@ describe('getPackagesToPublish', () => {
113110
});
114111

115112
// This happens for reasons outlined in https://github.com/microsoft/beachball/issues/1123
116-
it('excludes packages without calculated change type with bump: true (default)', () => {
113+
it('excludes packages without calculated change type', () => {
117114
const result = getPackagesToPublishWrapper({
118115
packageInfos: { 'pkg-a': {}, 'pkg-b': {} },
119116
modifiedPackages: new Set(['pkg-a', 'pkg-b']),
@@ -126,21 +123,6 @@ describe('getPackagesToPublish', () => {
126123
`);
127124
});
128125

129-
// This might change later if bump: false is actually thought through...
130-
// https://github.com/microsoft/beachball/issues/1125
131-
it('includes packages without calculated change type with bump: false', () => {
132-
const result = getPackagesToPublishWrapper(
133-
{
134-
packageInfos: { 'pkg-a': {}, 'pkg-b': {} },
135-
modifiedPackages: new Set(['pkg-a', 'pkg-b']),
136-
calculatedChangeTypes: { 'pkg-a': 'patch' },
137-
},
138-
{ bump: false }
139-
);
140-
expect(result).toEqual(['pkg-a', 'pkg-b']);
141-
expect(logs.mocks.log).not.toHaveBeenCalled();
142-
});
143-
144126
it('returns packages in topological order if requested', () => {
145127
// Sorting is tested in toposortPackages, so just use a simple graph here
146128
const result = getPackagesToPublishWrapper(
@@ -151,7 +133,6 @@ describe('getPackagesToPublish', () => {
151133
'pkg-c': {},
152134
},
153135
},
154-
undefined,
155136
{ toposort: true }
156137
);
157138
expect(result).toEqual(['pkg-c', 'pkg-b', 'pkg-a']);

src/publish/getPackagesToPublish.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { bulletedList } from '../logging/bulletedList';
2-
import type { BeachballOptions } from '../types/BeachballOptions';
32
import type { PublishBumpInfo } from '../types/BumpInfo';
43
import { toposortPackages } from './toposortPackages';
54

@@ -12,7 +11,6 @@ export function getPackagesToPublish(
1211
PublishBumpInfo,
1312
'modifiedPackages' | 'newPackages' | 'packageInfos' | 'calculatedChangeTypes' | 'scopedPackages'
1413
>,
15-
options: Pick<BeachballOptions, 'bump'>,
1614
params?: {
1715
/** If true, topologically sort the package names based on the dependency graph (may be slow) */
1816
toposort?: boolean;
@@ -40,10 +38,7 @@ export function getPackagesToPublish(
4038
skipReason = 'is private';
4139
} else if (!scopedPackages.allInScope && !scopedPackages.has(pkg)) {
4240
skipReason = 'is out-of-scope';
43-
} else if (options.bump && !changeType && !newPackages?.includes(pkg)) {
44-
// bump=false is the only time when this might be valid, but that behavior needs more thought...
45-
// TODO: remove `options.bump` exception and/or figure out how it should actually be handled
46-
// https://github.com/microsoft/beachball/issues/1125
41+
} else if (!changeType && !newPackages?.includes(pkg)) {
4742
skipReason = 'is not bumped (no calculated change type)';
4843
}
4944

src/publish/publishToRegistry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export async function publishToRegistry(bumpInfo: PublishBumpInfo, options: Beac
2727
}
2828

2929
// get the packages to publish, reducing the set by packages that don't need publishing
30-
const packagesToPublish = getPackagesToPublish(bumpInfo, options, { toposort: true, logSkipped: true });
30+
const packagesToPublish = getPackagesToPublish(bumpInfo, { toposort: true, logSkipped: true });
3131

3232
let invalid = false;
3333
// TODO: for bump=false, this should validate the on-disk versions, not in-memory bumped versions

src/validation/validate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export function validate(
213213
// Unfortunately, to get full info about which dependents would be bumped, it's probably necessary
214214
// to calculate the full bump info.
215215
bumpInfo = bumpInMemory(options, { originalPackageInfos, packageGroups, changeSet, scopedPackages });
216-
const packagesToPublish = getPackagesToPublish(bumpInfo, options);
216+
const packagesToPublish = getPackagesToPublish(bumpInfo);
217217

218218
if (!validatePackageDependencies(packagesToPublish, bumpInfo.packageInfos)) {
219219
logValidationError(`One or more published packages depend on an unpublished package!

0 commit comments

Comments
 (0)