diff --git a/change/beachball-acb1a827-f8e4-47bf-81aa-624ddcbe35ed.json b/change/beachball-acb1a827-f8e4-47bf-81aa-624ddcbe35ed.json new file mode 100644 index 000000000..6cd66546b --- /dev/null +++ b/change/beachball-acb1a827-f8e4-47bf-81aa-624ddcbe35ed.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "Add release types for major and minor prereleases", + "packageName": "beachball", + "email": "kjell.knapen@craftzing.com", + "dependentChangeType": "patch" +} diff --git a/src/__tests__/changefile/changeTypes.test.ts b/src/__tests__/changefile/changeTypes.test.ts index d8514c8be..33d382f75 100644 --- a/src/__tests__/changefile/changeTypes.test.ts +++ b/src/__tests__/changefile/changeTypes.test.ts @@ -19,17 +19,17 @@ describe('getMaxChangeType', () => { }); it('returns none if all given change types are disallowed', () => { - const changeType = getMaxChangeType('patch', 'major', ['major', 'minor', 'patch', 'prerelease']); + const changeType = getMaxChangeType('patch', 'major', ['major', 'minor', 'patch', 'prerelease', 'premajor', 'preminor', 'prepatch']); expect(changeType).toBe('none'); }); it('returns next greatest change type if max is disallowed', () => { - const changeType = getMaxChangeType('patch', 'major', ['major']); + const changeType = getMaxChangeType('patch', 'major', ['major', 'premajor', 'preminor', 'prepatch']); expect(changeType).toBe('minor'); }); it('handles prerelease only case', () => { - const changeType = getMaxChangeType('patch', 'major', ['major', 'minor', 'patch']); + const changeType = getMaxChangeType('patch', 'major', ['major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch']); expect(changeType).toBe('prerelease'); }); }); diff --git a/src/changefile/changeTypes.ts b/src/changefile/changeTypes.ts index b45272d6f..c6ef9aaa6 100644 --- a/src/changefile/changeTypes.ts +++ b/src/changefile/changeTypes.ts @@ -3,7 +3,7 @@ import { ChangeSet, ChangeType } from '../types/ChangeInfo'; /** * List of all change types from least to most significant. */ -export const SortedChangeTypes: ChangeType[] = ['none', 'prerelease', 'patch', 'minor', 'major']; +export const SortedChangeTypes: ChangeType[] = ['none', 'prerelease', 'prepatch', 'patch', 'preminor', 'minor', 'premajor', 'major']; /** * Change type with the smallest weight. diff --git a/src/changelog/renderPackageChangelog.ts b/src/changelog/renderPackageChangelog.ts index 04b8edbc1..94cd602dd 100644 --- a/src/changelog/renderPackageChangelog.ts +++ b/src/changelog/renderPackageChangelog.ts @@ -5,8 +5,11 @@ import { ChangeType } from '../types/ChangeInfo'; const groupNames: { [k in ChangeType]: string } = { major: 'Major changes', + premajor: 'Major changes (pre-release)', minor: 'Minor changes', + preminor: 'Minor changes (pre-release)', patch: 'Patches', + prepatch: 'Patches (pre-release)', prerelease: 'Changes', none: '', // not used }; diff --git a/src/types/ChangeInfo.ts b/src/types/ChangeInfo.ts index 0cfc3dcda..372e095b1 100644 --- a/src/types/ChangeInfo.ts +++ b/src/types/ChangeInfo.ts @@ -1,4 +1,4 @@ -export type ChangeType = 'prerelease' | 'patch' | 'minor' | 'major' | 'none'; +export type ChangeType = 'prerelease' | 'prepatch' |'patch' | 'preminor' |'minor' | 'premajor' |'major' | 'none'; /** * Info saved in each change file. diff --git a/src/validation/isValidDependentChangeType.ts b/src/validation/isValidDependentChangeType.ts index db6b476a1..ceed1039d 100644 --- a/src/validation/isValidDependentChangeType.ts +++ b/src/validation/isValidDependentChangeType.ts @@ -8,7 +8,7 @@ export function isValidDependentChangeType( const disallowedDependentChangeTypes = (disallowedChangeTypes || []).filter(t => t !== 'patch'); return ( - ['patch', 'major', 'minor', 'prerelease', 'none'].includes(dependentChangeType) && + ['patch', 'major', 'minor', 'prerelease', 'prepatch', 'praminor', 'premajor', 'none'].includes(dependentChangeType) && !disallowedDependentChangeTypes.includes(dependentChangeType) ); }