Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release types for major and minor prereleases #944

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions change/beachball-acb1a827-f8e4-47bf-81aa-624ddcbe35ed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Add release types for major and minor prereleases",
"packageName": "beachball",
"email": "kjell.knapen@craftzing.com",
"dependentChangeType": "patch"
}
6 changes: 3 additions & 3 deletions src/__tests__/changefile/changeTypes.test.ts
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ecraig12345 Does the test failing here signal that my changes are still breaking?

Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/changefile/changeTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions src/changelog/renderPackageChangelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
2 changes: 1 addition & 1 deletion src/types/ChangeInfo.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/validation/isValidDependentChangeType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}