Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Simplify and unify sorting mechanic
  • Loading branch information
getdave committed Jul 19, 2021
commit 9e19907d6db5427e83dfbe98e1451f2c0ad7b234
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