@@ -86,20 +86,44 @@ const getCompatibleArtifacts = ({
8686
8787/**
8888 * Generates the navigation links for the Node.js download archive
89- * It creates a list of links for each major release, formatted with the major
90- * version and codename if available.
89+ * It creates a list of links for each major release, grouped by status,
90+ * formatted with the major version and codename if available.
9191 */
9292export const getDownloadArchiveNavigation = ( releases : Array < NodeRelease > ) => {
93- const items = releases . map ( ( { major, codename, versionWithPrefix } ) => ( {
94- label : `Node.js v${ major } ${ codename ? `(${ codename } )` : '' } ` ,
95- value : `/download/${ versionWithPrefix } ` ,
96- } ) ) ;
97-
98- return [
99- {
100- items,
101- } ,
93+ // Define status order priority
94+ const statusOrder = [
95+ 'Current' ,
96+ 'Active LTS' ,
97+ 'Maintenance LTS' ,
98+ 'End-of-life' ,
99+ 'Pending' ,
102100 ] ;
101+
102+ // Group releases by status
103+ const groupedByStatus = releases . reduce (
104+ ( acc , release ) => {
105+ const { status, major, codename, versionWithPrefix } = release ;
106+
107+ if ( ! acc [ status ] ) {
108+ acc [ status ] = [ ] ;
109+ }
110+
111+ acc [ status ] . push ( {
112+ label : `Node.js v${ major } ${ codename ? `(${ codename } )` : '' } ` ,
113+ value : `/download/${ versionWithPrefix } ` ,
114+ } ) ;
115+
116+ return acc ;
117+ } ,
118+ { } as Record < string , Array < { label : string ; value : string } > >
119+ ) ;
120+
121+ return statusOrder
122+ . filter ( status => groupedByStatus [ status ] )
123+ . map ( status => ( {
124+ label : status ,
125+ items : groupedByStatus [ status ] ,
126+ } ) ) ;
103127} ;
104128
105129/**
0 commit comments