@@ -84,39 +84,38 @@ const getCompatibleArtifacts = ({
8484 } ) ;
8585} ;
8686
87+ // Define status order priority
88+ const statusOrder = [
89+ 'Current' ,
90+ 'Active LTS' ,
91+ 'Maintenance LTS' ,
92+ 'End-of-life' ,
93+ 'Pending' ,
94+ ] ;
95+
96+ type Navigations = Record < string , Array < { label : string ; value : string } > > ;
97+
8798/**
8899 * Generates the navigation links for the Node.js download archive
89100 * It creates a list of links for each major release, grouped by status,
90101 * formatted with the major version and codename if available.
91102 */
92103export const getDownloadArchiveNavigation = ( releases : Array < NodeRelease > ) => {
93- // Define status order priority
94- const statusOrder = [
95- 'Current' ,
96- 'Active LTS' ,
97- 'Maintenance LTS' ,
98- 'End-of-life' ,
99- 'Pending' ,
100- ] ;
101-
102104 // Group releases by status
103- const groupedByStatus = releases . reduce (
104- ( acc , release ) => {
105- const { status, major, codename, versionWithPrefix } = release ;
105+ const groupedByStatus = releases . reduce ( ( acc , release ) => {
106+ const { status, major, codename, versionWithPrefix } = release ;
106107
107- if ( ! acc [ status ] ) {
108- acc [ status ] = [ ] ;
109- }
108+ if ( ! acc [ status ] ) {
109+ acc [ status ] = [ ] ;
110+ }
110111
111- acc [ status ] . push ( {
112- label : `Node.js v${ major } .x ${ codename ? `(${ codename } )` : '' } ` ,
113- value : `/download/archive/${ versionWithPrefix } ` ,
114- } ) ;
112+ acc [ status ] . push ( {
113+ label : `Node.js v${ major } .x ${ codename ? `(${ codename } )` : '' } ` ,
114+ value : `/download/archive/${ versionWithPrefix } ` ,
115+ } ) ;
115116
116- return acc ;
117- } ,
118- { } as Record < string , Array < { label : string ; value : string } > >
119- ) ;
117+ return acc ;
118+ } , { } as Navigations ) ;
120119
121120 return statusOrder
122121 . filter ( status => groupedByStatus [ status ] )
0 commit comments