@@ -27,6 +27,15 @@ import { TopicDitamap } from './ditamap/topic-ditamap';
27
27
import { events , punctuate } from './utils' ;
28
28
import { HelpReference } from './ditamap/help-reference' ;
29
29
30
+ function emitNoTopicMetadataWarning ( topic : string ) : void {
31
+ events . emit (
32
+ 'warning' ,
33
+ `No metadata for topic ${ chalk . bold (
34
+ topic
35
+ ) } . That topic owner must add topic metadata in the oclif section in the package.json file within their plugin.`
36
+ ) ;
37
+ }
38
+
30
39
export class Docs {
31
40
public constructor (
32
41
private outputDir : string ,
@@ -50,22 +59,21 @@ export class Docs {
50
59
) ;
51
60
let description = asString ( topicMeta . description ) ;
52
61
if ( ! description && ! topicMeta . external ) {
53
- // Punctuate the description in place of longDescription
54
62
description = punctuate ( asString ( topicMeta . description ) ) ;
55
63
if ( ! description ) {
56
64
events . emit (
57
65
'warning' ,
58
66
`No description for topic ${ chalk . bold (
59
67
topic
60
- ) } . Skipping until topic owner adds topic metadata, that includes longDescription, in the oclif section in the package.json file within their plugin.`
68
+ ) } . Skipping until topic owner adds topic metadata in the oclif section in the package.json file within their plugin.`
61
69
) ;
62
70
return ;
63
71
}
64
72
}
65
73
66
74
const subTopicNames = [ ] ;
67
75
const commandIds = [ ] ;
68
- // const commandFileNames = [];
76
+
69
77
for ( const subtopic of Object . keys ( subtopics ) ) {
70
78
const subtopicOrCommand = subtopics [ subtopic ] ;
71
79
try {
@@ -81,13 +89,7 @@ export class Docs {
81
89
const subTopicsMeta = ensureJsonMap ( topicMeta . subtopics ) ;
82
90
83
91
if ( ! subTopicsMeta [ subtopic ] ) {
84
- const fullTopicPath = `${ topic } :${ subtopic } ` ;
85
- events . emit (
86
- 'warning' ,
87
- `No metadata for topic ${ chalk . bold (
88
- fullTopicPath
89
- ) } . That topic owner must add topic metadata in the oclif section in the package.json file within their plugin.`
90
- ) ;
92
+ emitNoTopicMetadataWarning ( `${ topic } :${ subtopic } ` ) ;
91
93
continue ;
92
94
}
93
95
@@ -108,7 +110,11 @@ export class Docs {
108
110
commandIds . push ( command . id ) ;
109
111
}
110
112
} catch ( error ) {
111
- events . emit ( 'warning' , `Can't create topic for ${ topic } :${ subtopic } : ${ error . message } \n` ) ;
113
+ if ( error . name === 'UnexpectedValueTypeError' ) {
114
+ emitNoTopicMetadataWarning ( `${ topic } :${ subtopic } ` ) ;
115
+ } else {
116
+ events . emit ( 'warning' , `Can't create topic for ${ topic } :${ subtopic } : ${ error . message } \n` ) ;
117
+ }
112
118
}
113
119
}
114
120
0 commit comments