Skip to content

Improve logic for pre* change types (when to use/show) #947

@ecraig12345

Description

@ecraig12345

Support for manually entering change types prepatch/preminor/premajor was added in #944, but those extra change types aren't currently shown in the prompt since this would be perceived as a breaking change.

Some further thought is needed about how to handle these extra change types:

  • Should they be included by default and removed if needed by disallowedChangeTypes? This seems like unfortunate extra configuration for the more common case where repos don't want the extra prerelease types.
  • Alternative: add an option like includeAllPrereleaseTypes which makes the extra prerelease types show up by default when prerelease.
  • Alternative: add an option like showPrereleaseTypes?: ChangeType[] which makes prerelease versions show up in the prompt even when the current version isn't a prerelease. The prompt should also ask for a prerelease prefix if not specified (Prompt for prerelease suffix if not already specified #21) and there should be a way to specify the prefix without globally forcing prerelease change types (Odd prereleasePrefix behavior with non-prerelease change types #1098).

#944 also introduced a bug related to demoting disallowed change types, where a type like premajor could be introduced accidentally when the actual desired type is probably patch...

it('should respect disallowed change type', () => {
const bumpInfo = callUpdateRelatedChangeType({
changes: [{ packageName: 'bar', type: 'major', dependentChangeType: 'minor' }],
packages: {
bar: {},
foo: {
dependencies: { bar: '1.0.0' },
beachball: { disallowedChangeTypes: ['minor', 'major'] },
},
},
});
expect(bumpInfo.calculatedChangeTypes).toEqual({
bar: 'major',
// This points out an interesting artifact of the new pre* support that should probably be
// better rationalized... (prior to that change, this would have been 'patch', which is
// more likely the expected behavior in general)
foo: 'preminor',
});
});
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions