@@ -31,6 +31,9 @@ const VALID_COMPONENTS_CATEGORIES = [
31
31
32
32
function buildDocs ( apiFolders , componentsPreProcess ) {
33
33
let components = readComponentsFromApiFiles ( apiFolders ) ;
34
+
35
+ logStatistics ( components ) ;
36
+
34
37
components = componentsPreProcess ?. ( components ) ?? components ;
35
38
resetDocsDir ( ) ;
36
39
processComponents ( components ) ;
@@ -134,6 +137,22 @@ function generateExtendsLink(extendsLink) {
134
137
return extendsText ;
135
138
}
136
139
140
+ function logStatistics ( components ) {
141
+ const groupedComponents = _ . countBy ( components , 'name' ) ;
142
+ const duplicateComponents = Object . entries ( groupedComponents )
143
+ . filter ( ( [ _ , count ] ) => count > 1 )
144
+ . map ( ( [ name , count ] ) => `${ name } (${ count } times)` ) ;
145
+
146
+ if ( duplicateComponents . length > 0 ) {
147
+ console . log ( 'Components with multiple occurrences:\n-' , duplicateComponents . join ( '\n- ' ) ) ;
148
+ }
149
+
150
+ const componentsWithoutSnippet = components . filter ( c => ! c . snippet ) . map ( c => c . name ) ;
151
+ if ( componentsWithoutSnippet . length > 0 ) {
152
+ console . log ( 'Components missing snippet:\n-' , componentsWithoutSnippet . join ( '\n- ' ) ) ;
153
+ }
154
+ }
155
+
137
156
function buildOldDocs ( component ) {
138
157
let content = '' ;
139
158
content += `import UILivePreview from '@site/src/components/UILivePreview';\n\n` ;
@@ -197,8 +216,6 @@ function buildOldDocs(component) {
197
216
?. map ( item => _ . replace ( item , new RegExp ( / \$ [ 1 - 9 ] / , 'g' ) , '' ) )
198
217
. join ( '\n' )
199
218
. toString ( ) } \`}/>\n\n`;
200
- } else {
201
- console . warn ( `${ component . name } does not have a snippet` ) ;
202
219
}
203
220
204
221
/* Props */
0 commit comments