Skip to content

Commit

Permalink
Simplify and unify sorting mechanic
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Jul 19, 2021
1 parent c39c778 commit 9e19907
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions bin/plugin/commands/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const LABEL_FEATURE_MAPPING = {
'[Feature] UI Components': 'Components',
'[Feature] Component System': 'Components',
'[Feature] Template Editing Mode': 'Template Editor',
'[Feature] Writing Flow': 'Block Editor',
'[Feature] Blocks': 'Block Library',
'[Feature] Inserter': 'Block Editor',
'[Feature] Drag and Drop': 'Block Editor',
Expand Down Expand Up @@ -633,17 +634,14 @@ async function getChangelog( settings ) {
changelog += '### ' + group + '\n\n';

Object.keys( featureGroups )
.sort( ( a, b ) => {
return featureGroups[ b ].length - featureGroups[ a ].length;
} )
.sort( ( a, b ) => {
// sort "Unknown" to always be at the end
if ( a === 'Unknown' ) {
return 1;
} else if ( b === 'Unknown' ) {
return -1;
}
return 0;
return featureGroups[ b ].length - featureGroups[ a ].length;
} )
.forEach( ( feature ) => {
const featureGroup = featureGroups[ feature ];
Expand Down

0 comments on commit 9e19907

Please sign in to comment.