@@ -22,11 +22,6 @@ export function load (app) {
22
22
// pages of the current module or monorepo packages
23
23
app . renderer . on ( td . RendererEvent . END , ( /** @type {td.RendererEvent } */ evt ) => {
24
24
const urlMappings = evt . urls ?. filter ( urlMapping => {
25
- // skip anything without a model-level comment
26
- if ( urlMapping . model ?. comment == null ) {
27
- return false
28
- }
29
-
30
25
// single-module repo, single export
31
26
if ( urlMapping . url === 'modules.html' ) {
32
27
return true
@@ -44,10 +39,6 @@ export function load (app) {
44
39
45
40
return false
46
41
} ) . map ( urlMapping => {
47
- if ( urlMapping . model ?. comment == null ) {
48
- throw new Error ( 'Model comment was null' )
49
- }
50
-
51
42
if ( isMonorepoParent ) {
52
43
let project = urlMapping . model . name
53
44
@@ -59,21 +50,48 @@ export function load (app) {
59
50
throw new Error ( `Could not derive project name from url mapping model "${ urlMapping . model . name } " with parent "${ urlMapping . model . parent ?. name } "` )
60
51
}
61
52
53
+ let comment = urlMapping . model ?. comment
54
+
55
+ if ( comment == null && urlMapping . model instanceof td . DeclarationReflection && urlMapping . model . children != null && urlMapping . model . children . length > 0 ) {
56
+ // multi-export modules have a different structure
57
+ comment = urlMapping . model . children
58
+ . find ( child => child . name === 'index' )
59
+ ?. comment
60
+ }
61
+
62
+ if ( comment == null ) {
63
+ return null
64
+ }
65
+
62
66
return {
63
- comment : urlMapping . model . comment ,
67
+ comment,
64
68
manifestPath : path . join ( projects [ project ] . dir , 'package.json' ) ,
65
69
readmePath : path . join ( projects [ project ] . dir , 'README.md' )
66
70
}
67
71
}
68
72
73
+ if ( urlMapping . model ?. comment == null ) {
74
+ return null
75
+ }
76
+
69
77
return {
70
78
comment : urlMapping . model . comment ,
71
79
manifestPath : path . join ( process . cwd ( ) , 'package.json' ) ,
72
80
readmePath : path . join ( process . cwd ( ) , 'README.md' )
73
81
}
74
82
} )
75
83
76
- urlMappings ?. forEach ( urlMapping => updateModule ( urlMapping . comment , urlMapping . manifestPath , urlMapping . readmePath , app ) )
84
+ if ( urlMappings == null ) {
85
+ return
86
+ }
87
+
88
+ for ( const urlMapping of urlMappings ) {
89
+ if ( urlMapping == null ) {
90
+ continue
91
+ }
92
+
93
+ updateModule ( urlMapping . comment , urlMapping . manifestPath , urlMapping . readmePath , app )
94
+ }
77
95
} )
78
96
}
79
97
0 commit comments