@@ -48,9 +48,8 @@ async function main() {
48
48
) ;
49
49
50
50
let storedContent = new Array ( Object . keys ( sideBar ) . length ) ;
51
- const promiseChain = Object . entries ( sideBar )
52
- . sort ( ( x , y ) => x [ 1 ] . order - y [ 1 ] . order )
53
- . map ( async ( entry , index , source ) => {
51
+ const promiseChain = Object . entries ( sideBar ) . map (
52
+ async ( entry , index , source ) => {
54
53
const [ key , value ] = entry ;
55
54
return fetch ( `${ value . source } .md` ) . then ( async ( d ) => {
56
55
if ( ! d . ok ) {
@@ -67,23 +66,23 @@ async function main() {
67
66
layoutSpacing . push ( "pb-12 mb-12" ) ;
68
67
}
69
68
storedContent . push ( {
70
- order : value . order ,
69
+ order : value . order || Infinity ,
71
70
content : `<section id="${ key } " class="flex flex-col ${ layoutSpacing
72
71
. filter ( Boolean )
73
72
. join ( " " ) } ">
74
73
${ await marked ( content , { } ) }
75
74
</section>` ,
76
75
} ) ;
77
76
} ) ;
78
- } ) ;
77
+ }
78
+ ) ;
79
79
80
80
await promiseChain . reduce ( ( acc , item ) => {
81
81
return acc . then ( ( _ ) => item ) ;
82
82
} , Promise . resolve ( ) ) ;
83
83
84
- console . log ( { storedContent } ) ;
85
84
const usableContent = storedContent
86
- // .sort((x, y) => x.order - y.order)
85
+ . sort ( ( x , y ) => x . order - y . order )
87
86
. map ( ( x ) => {
88
87
return x . content ;
89
88
} )
0 commit comments