@@ -6,7 +6,6 @@ import parseAuthor from 'parse-author';
66import dateStringified from '../../utils/date-stringify' ;
77import indexView from '../views' ;
88import getAvailableDependencies from './helpers/get-available-dependencies' ;
9- import getComponentsHistory from './helpers/get-components-history' ;
109import urlBuilder = require( '../domain/url-builder' ) ;
1110import type { IncomingHttpHeaders } from 'node:http' ;
1211import type { NextFunction , Request , Response } from 'express' ;
@@ -76,41 +75,36 @@ export default function (repository: Repository) {
7675 componentsInfo = componentsInfo . sort ( ( a , b ) =>
7776 a . name . localeCompare ( b . name )
7877 ) ;
79- fromPromise ( repository . getComponentsDetails ) ( ( err , details ) => {
80- if ( err ) console . log ( err ) ;
81- res . send (
82- indexView (
83- // @ts -ignore
84- Object . assign ( baseResponse , {
85- availableDependencies : getAvailableDependencies (
86- res . conf . dependencies
87- ) ,
88- availablePlugins : res . conf . plugins ,
89- components : componentsInfo ,
90- componentsReleases,
91- componentsList : componentsInfo . map ( ( component ) => {
92- const state : 'deprecated' | 'experimental' | '' =
93- component ?. oc ?. state || '' ;
94- if ( state ) {
95- stateCounts [ state ] = ( stateCounts [ state ] || 0 ) + 1 ;
96- }
78+ res . send (
79+ indexView (
80+ // @ts -ignore
81+ Object . assign ( baseResponse , {
82+ availableDependencies : getAvailableDependencies (
83+ res . conf . dependencies
84+ ) ,
85+ availablePlugins : res . conf . plugins ,
86+ components : componentsInfo ,
87+ componentsReleases,
88+ componentsList : componentsInfo . map ( ( component ) => {
89+ const state : 'deprecated' | 'experimental' | '' =
90+ component ?. oc ?. state || '' ;
91+ if ( state ) {
92+ stateCounts [ state ] = ( stateCounts [ state ] || 0 ) + 1 ;
93+ }
9794
98- return {
99- name : component . name ,
100- author : component . author ,
101- state
102- } ;
103- } ) ,
104- componentsHistory :
105- ! res . conf . local && getComponentsHistory ( details ) ,
106- q : req . query [ 'q' ] || '' ,
107- stateCounts,
108- templates : repository . getTemplatesInfo ( ) ,
109- title : 'OpenComponents Registry'
110- } )
111- )
112- ) ;
113- } ) ;
95+ return {
96+ name : component . name ,
97+ author : component . author ,
98+ state
99+ } ;
100+ } ) ,
101+ q : req . query [ 'q' ] || '' ,
102+ stateCounts,
103+ templates : repository . getTemplatesInfo ( ) ,
104+ title : 'OpenComponents Registry'
105+ } )
106+ )
107+ ) ;
114108 }
115109 ) ;
116110 } else {
0 commit comments